[haiku-bugs] [Haiku] #12835: [Patch] pcl6: Fix mismatching allocation and deallocation

  • From: "mt" <trac@xxxxxxxxxxxx>
  • Date: Mon, 27 Jun 2016 21:59:17 -0000

#12835: [Patch] pcl6: Fix mismatching allocation and deallocation
------------------------------+------------------------------
 Reporter:  mt                |        Owner:  phoudoin
     Type:  bug               |       Status:  new
 Priority:  normal            |    Milestone:  Unscheduled
Component:  Drivers/Printers  |      Version:  R1/Development
 Keywords:  pcl6              |   Blocked By:
 Blocking:                    |  Has a Patch:  0
 Platform:  All               |
------------------------------+------------------------------
 fSeedRow and fBuffer are allocated by new[] [1][2], but deallocated by
 delete [3][4].
 [1] http://cgit.haiku-os.org/haiku/tree/src/add-
 ons/print/drivers/pcl6/DeltaRowCompression.cpp#n19
 [2] http://cgit.haiku-os.org/haiku/tree/src/add-
 ons/print/drivers/pcl6/PCL6Writer.cpp#n20
 [3] http://cgit.haiku-os.org/haiku/tree/src/add-
 ons/print/drivers/pcl6/DeltaRowCompression.cpp#n29
 [4] http://cgit.haiku-os.org/haiku/tree/src/add-
 ons/print/drivers/pcl6/PCL6Writer.cpp#n29

 {{{
 /home/haiku/haiku/haiku/src/add-
 ons/print/drivers/pcl6/DeltaRowCompression.cpp:29:2: warning: 'delete'
 applied to a pointer that was allocated with 'new[]'; did you mean
 'delete[]'? [-Wmismatched-new-delete]
         delete fSeedRow;
         ^
               []
 /home/haiku/haiku/haiku/src/add-
 ons/print/drivers/pcl6/DeltaRowCompression.cpp:19:11: note: allocated with
 'new[]' here
         fSeedRow(new uchar[rowSize]),
                  ^
 /home/haiku/haiku/haiku/src/add-
 ons/print/drivers/pcl6/PCL6Writer.cpp:29:2: warning: 'delete' applied to a
 pointer that was allocated with 'new[]'; did you mean 'delete[]'?
 [-Wmismatched-new-delete]
         delete fBuffer;
         ^
               []
 /home/haiku/haiku/haiku/src/add-
 ons/print/drivers/pcl6/PCL6Writer.cpp:20:10: note: allocated with 'new[]'
 here
         fBuffer(new uint8[bufferSize]),
                 ^
 }}}

--
Ticket URL: <https://dev.haiku-os.org/ticket/12835>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: