Again: pointer being freed was not allocated

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
mlo
Posts: 12
Joined: 2012-05-28T22:45:20-07:00
Authentication code: 13

Again: pointer being freed was not allocated

Post 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
$
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Again: pointer being freed was not allocated

Post 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.
mlo
Posts: 12
Joined: 2012-05-28T22:45:20-07:00
Authentication code: 13

Re: Again: pointer being freed was not allocated

Post 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).
mlo
Posts: 12
Joined: 2012-05-28T22:45:20-07:00
Authentication code: 13

Re: Again: pointer being freed was not allocated

Post by mlo »

Now, with ImageMagick 6.7.9-0 released by MacPorts, my problems are solved. Thank you all!
Post Reply