Page 1 of 1

Again: pointer being freed was not allocated

Posted: 2012-07-29T22:09:56-07:00
by mlo
Some time ago, I posted about a bug that, according to magick on 29-5-2012 has been corrected. As of today, that bug is still present in the MacPorts release.

Here is a minimal example:

$ port list ImageMagick
ImageMagick @6.7.8-3 graphics/ImageMagick
$ wget http://www.imagemagick.org/image/logo.jpg
...
$ identify logo.jpg
$ logo.jpg JPEG 123x118 123x118+0+0 8-bit DirectClass 16.2KB 0.000u 0:00.000
$ cat minimal.cxx

Code: Select all

#include <iostream>
#include <Magick++.h>

using namespace std;
using namespace Magick;

int main() {
try {
Image sourceImage("logo.jpg");
Image newImage(sourceImage);
newImage.zoom("50x");
newImage.write("newlogo.jpg");
} catch (Error &e) {
cerr << e.what() << '\n';
} catch (...) {
cerr << "Unknown exception catched\n";
}
}
$ g++ `Magick++-config --cppflags --cxxflags --ldflags --libs` -o minimal minimal.cxx
$ ./minimal
minimal(18180) malloc: *** error for object 0xb00007fff48c14c7: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
$

Re: Again: pointer being freed was not allocated

Posted: 2012-07-30T04:29:03-07:00
by magick
Unfortunately we cannot reproduce the problem. Post the results of
  • gdb ./minimal
    run
    where
The stack trace may help trace the double free.

Re: Again: pointer being freed was not allocated

Posted: 2012-07-30T22:30:39-07:00
by mlo
Unluckily, the program when executed under the debugger runs to its normal end without any error. There are a lot of warnings about object files and debug informations missing (obviously), then the program exits normally writing the output file 'newlogo.jpg' correctly scaled. Setting a breakpoint in malloc_error_break, that procedure is never reached. However, running the executable directly without the debugger leads to 'pointer being freed was not allocated' and to abort (no output file).

Re: Again: pointer being freed was not allocated

Posted: 2012-08-17T11:38:28-07:00
by mlo
Now, with ImageMagick 6.7.9-0 released by MacPorts, my problems are solved. Thank you all!