Opened 8 years ago

Closed 8 years ago

#12834 closed bug (fixed)

[Patch] PairsView.cpp: Fix mismatching allocation and deallocation

Reported by: mt Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Applications Version: R1/Development
Keywords: Pairs Cc:
Blocked By: Blocking:
Platform: All

Description

fRandomPosition, fPositionX and fPositionY are allocated by new[] [1], but deallocated by delete [2]. [1] http://cgit.haiku-os.org/haiku/tree/src/apps/pairs/PairsView.cpp#n53 [2] http://cgit.haiku-os.org/haiku/tree/src/apps/pairs/PairsView.cpp#n83

/home/haiku/haiku/haiku/src/apps/pairs/PairsView.cpp:83:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
        delete fRandomPosition;
        ^
              []
/home/haiku/haiku/haiku/src/apps/pairs/PairsView.cpp:53:18: note: allocated with 'new[]' here
        fRandomPosition(new int32[fButtonsCount]),
                        ^
/home/haiku/haiku/haiku/src/apps/pairs/PairsView.cpp:84:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
        delete fPositionX;
        ^
              []
/home/haiku/haiku/haiku/src/apps/pairs/PairsView.cpp:54:13: note: allocated with 'new[]' here
        fPositionX(new int32[fButtonsCount]),
                   ^
/home/haiku/haiku/haiku/src/apps/pairs/PairsView.cpp:85:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
        delete fPositionY;
        ^
              []
/home/haiku/haiku/haiku/src/apps/pairs/PairsView.cpp:55:13: note: allocated with 'new[]' here
        fPositionY(new int32[fButtonsCount])
                   ^

Attachments (1)

0019-PairsView.cpp-Fix-mismatching-allocation-and-dealloc.patch (788 bytes ) - added by mt 8 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 by mt, 8 years ago

patch: 01

comment:2 by jscipione, 8 years ago

Resolution: fixed
Status: newclosed

Patch applied in hrev50376

Note: See TracTickets for help on using tickets.