malloc'ed char-string gets delete[]d
Issue #258
closed
Originally reported on Google Code with ID 258
While studying the source code (pulled from github), I found that the
char* buffer in _doFormat() is created using the C-style malloc()
allocator, but is destroyed in operator<<() using the C++-style delete[]
deallocator. This asymmetry is really bad and should be fixed, either by
using new[] in the first place or free() in the second.
Reported by andreas_scherer@alice.de
on 2009-02-21 07:58:49
Comments (6)
-
Account Deleted -
Account Deleted ``` Here's a fix, created against commit '5bda34...'. 'testhmath' runs clean. ```
Reported by `andreas_scherer@alice.de` on 2009-02-21 09:51:55
<hr>
- *Attachment: [0001-Use-symmetric-memory-management.patch](https://storage.googleapis.com/google-code-attachments/speedcrunch/issue-258/comment-3/0001-Use-symmetric-memory-management.patch)*
-
Account Deleted ``` Code change applied. ```
Reported by `andreas_scherer@alice.de` on 2009-02-22 19:22:12 - Status changed: `Fixed` - Labels added: Type-Defect, Priority-Medium
-
Account Deleted Reported by `helder.pereira.correia` on 2009-02-22 19:32:38 - Labels added: Milestone-0.11
-
repo owner -
repo owner - changed status to closed
- Log in to comment
``` Also affected, core/evaluator.cpp: operator<<() calls HMath::formatFixed and delete[]s the result. ```
Reported by `andreas_scherer@alice.de` on 2009-02-21 08:47:48