View Issue Details

IDProjectCategoryView StatusLast Update
0013318ScribusPDFpublic2015-11-22 13:54
Reporterwilliam Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Platformx86_64OSLinuxOS VersionFedora 20
Product Version1.5.1svn 
Fixed in Version1.5.1svn 
Summary0013318: Scribus 1.5.1 gets valgrind error "Mismatched free() / delete / delete []"
Descriptionvalgrind reports
==10394== Mismatched free() / delete / delete []
==10394== at 0x4A080F1: operator delete(void*) (vg_replace_malloc.c:507)
==10394== by 0xE4C08D: ScJpegEncodeFilterData::~ScJpegEncodeFilterData() (scstreamfilter_jpeg.cpp:118)
==10394== by 0xE4C274: ScJpegEncodeFilter::freeData() (scstreamfilter_jpeg.cpp:147)
...
==10394== Address 0x31d477a0 is 0 bytes inside a block of size 5,310 alloc'd
==10394== at 0x4A0776A: operator new[](unsigned long) (vg_replace_malloc.c:389)
==10394== by 0xE4C552: ScJpegEncodeFilter::openFilter() (scstreamfilter_jpeg.cpp:202)
==10394== by 0xC74453: ScImage::convert2JPG(QString, int, bool, bool) (scimage.cpp:1209)

scstreamfilter_jpeg.cpp has ScJpegEncodeFilter::openFilter() with
 m_filterData->row_pointer[0] = new uchar[m_filterData->cinfo.image_width * m_filterData->cinfo.input_components];
but ScJpegEncodeFilterData::~ScJpegEncodeFilterData() with
 delete row_pointer[0];
but since row_pointer[0] was created with new uchar[], it should be freed with
 delete [] row_pointer[0];

I have attached a patch.
Steps To ReproduceIt happens when I export a document to PDF.
TagsNo tags attached.
PatchYes

Activities

william

2015-08-27 07:20

updater  

scribus15-delete-20150827-022717.patch (414 bytes)   
--- scribus15/scribus/scstreamfilter_jpeg.cpp-	2014-08-07 21:22:06.621838015 -0400
+++ scribus15/scribus/scstreamfilter_jpeg.cpp	2015-08-27 02:07:33.089946721 -0400
@@ -115,7 +115,7 @@
 	if (cdest)
 		delete cdest;
 	if (row_pointer[0])
-		delete row_pointer[0];
+		delete [] row_pointer[0];
 }
 
 ScJpegEncodeFilter::ScJpegEncodeFilter(QDataStream* stream, unsigned int imgWidth, unsigned int imgHeight, 

jghali

2015-08-27 11:30

administrator   ~0036093

Applied, thanks!

Kunda

2015-08-27 14:23

updater   ~0036099

Commits r20346/9.
Thanks William and jghali!

Issue History

Date Modified Username Field Change
2015-08-27 07:20 william New Issue
2015-08-27 07:20 william File Added: scribus15-delete-20150827-022717.patch
2015-08-27 11:30 jghali Note Added: 0036093
2015-08-27 11:30 jghali Status new => resolved
2015-08-27 11:30 jghali Fixed in Version => 1.5.1svn
2015-08-27 11:30 jghali Resolution open => fixed
2015-08-27 11:30 jghali Assigned To => jghali
2015-08-27 14:23 Kunda Note Added: 0036099
2015-08-27 14:23 Kunda Status resolved => closed
2015-11-22 13:54 jghali Summary [patch] Scribus 1.5.1 gets valgrind error "Mismatched free() / delete / delete []" => Scribus 1.5.1 gets valgrind error "Mismatched free() / delete / delete []"