[Bug 442935] New: asc-2.1.0.0-66.7: 3 * possible memory leaks
https://bugzilla.novell.com/show_bug.cgi?id=442935 Summary: asc-2.1.0.0-66.7: 3 * possible memory leaks Product: openSUSE 11.1 Version: Factory Platform: All OS/Version: openSUSE 11.0 Status: NEW Severity: Normal Priority: P5 - None Component: Other AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: dcb314@hotmail.com QAContact: qa@suse.de Found By: --- I just checked some of the source code in the Suse Linux factory package asc-2.1.0.0-66.7 and I noticed the following $ fgrep directionTranslation ../BUILD/asc-2.1.0.0/source/edmisc.cpp | egrep "new|delete" directionTranslation = new int[ 6 ]; delete directionTranslation; directionTranslation = new int[ 6 ]; delete directionTranslation; directionTranslation = new int[ 6 ]; delete directionTranslation; All three calls to delete are wrong. If you are lucky, you might only get a memory leak, otherwise a possible crash. Suggest new code delete [] directionTranslation; for each of the three cases. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=442935
Andreas Jaeger
https://bugzilla.novell.com/show_bug.cgi?id=442935
User prusnak@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=442935#c1
Pavol Rusnak
https://bugzilla.novell.com/show_bug.cgi?id=442935
User prusnak@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=442935#c2
Pavol Rusnak
https://bugzilla.novell.com/show_bug.cgi?id=442935
User prusnak@novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=442935#c3
--- Comment #3 from Pavol Rusnak
All three calls to delete are wrong. If you are lucky, you might only get a memory leak, otherwise a possible crash.
Just a remark: The calls to delete ARE wrong, but will not cause any memory leak or crash in this situation. Difference between delete and delete[] is that the second will call destructor to all the members of "array". When members are simple types (char, int, i.e. not classes with destructor actually doing something) then the delete and delete[] will only free the memory. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=442935
User dcb314@hotmail.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=442935#c4
--- Comment #4 from David Binderman
Just a remark: The calls to delete ARE wrong
Agreed. The calls are undefined according to my reading of the language standard ISO (ANSI, BSI, DIN, ...) C++. So, as I see it, the issue isn't that the code works or not on the current implementation, it is a more strategic issue about how close Suse wish to be to the C++ international standard and avoid "known to be undefined but happens to work" code. My opinion is that undefined code is worth avoiding at almost all costs, but Suse are entirely free to have a different opinion. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com