Bug 37747

Summary: exempi CDFileHeader::release() uses delete instead of delete[] for new[] from CDFileHeader::read
Product: exempi Reporter: Andre Klapper <a9016009>
Component: ProblemsAssignee: Hubert Figuiere <hub>
Status: RESOLVED FIXED QA Contact: Hubert Figuiere <hub>
Severity: normal    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: Other   
OS: All   
See Also: https://bugs.meego.com/show_bug.cgi?id=14661
Whiteboard: [release:2.2.0]
i915 platform: i915 features:

Description Andre Klapper 2011-05-30 07:20:27 UTC
Upstreaming from https://bugs.meego.com/show_bug.cgi?id=14661 .
Still valid in http://cgit.freedesktop.org/exempi/tree/source/XMPFiles/FileHandlers/UCF_Handler.hpp

PATCH by Josh Soref:
https://bugs.meego.com/attachment.cgi?id=4995&action=diff
change all delete's to delete[]'s to match new[]


372         class CDFileHeader {
374                         void release()  //*** needed or can go?
please note that delete is null safe, but, it's still wrong as this should be
delete[]:
376                                 if (filename)   delete filename;
377                                 if (extraField) delete extraField;
378                                 if (comment)    delete comment;

473                         void read(LFA_FileRef file)
475                                 this->release();
485                                         filename = new char[filenameLen];
489                                         extraField = new
char[extraFieldLen];
493                                         comment = new char[commentLen];

I'm not marking up the other cases in this file, but i've provided a patch
which is complete for the file.

there are lots of web references for this, Google's first hit was:
http://blogs.msdn.com/b/oldnewthing/archive/2004/02/03/66660.aspx
and oldnewthing is a very good reading source
Comment 1 Hubert Figuiere 2011-05-31 21:03:40 UTC
The patch does not apply against master...
Comment 2 Hubert Figuiere 2011-05-31 21:29:57 UTC
readapted the patch to master.

thanks.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.