Error: pointer being freed was not allocated
Posted: 2012-05-28T22:55:03-07:00
I am using ImageMagick on Mac OS X Lion (10.7.4) with MacPorts release ImageMagick-6.7.7-2_0+q16.darwin_11.x86_64. The relevant code snippet (C++) is:
Image newImage(sourceImage);
cout << progName << ": image opened" << endl;
if (!nothingToDo) {
cout << progName << ": 'conv.str()' is " << conv.str() << endl;
newImage.zoom(conv.str());
cout << progName << ": image zoomed by " << conv << endl;
}
The compile/link command is:
g++ -std=c++98 -W -Wall -O2 -DHOME="\"/Users/loreti\"" \
`Magick++-config --cppflags --cxxflags` -c -o prs.o prs.cxx
gcc -std=c99 -pedantic -W -Wall -O2 -DHOME="\"/Users/loreti\"" -c -o cutils.o cutils.c
g++ \
`Magick++-config --ldflags --libs` -o prs prs.o cutils.o
The program output is:
MLO@bigmac 26 $ ./prs -f ~/work -l mprs: end of command line processing.
From: "/Users/loreti/work"
To: "/Users/loreti/tmp"
Length: 768 pixels
Size: 500 kBytes
prs: skipped "."
prs: skipped ".."
prs: skipped ".DS_Store"
prs: inserted "IMG_3992.JPG"
prs: source "/Users/loreti/work", destination "/Users/loreti/tmp".
prs: image opened
prs: 'conv.str()' is 768x
prs(57402) malloc: *** error for object 0x8000000000000000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
Obviously there is an internal error in your library triggered by the statement newImage.zoom("768x").
The original image, copied to newImage for resining, is:
MLO@bigmac 27 $ identify ~/work/IMG_3992.JPG
/Users/loreti/work/IMG_3992.JPG JPEG 4353x3132 4353x3132+0+0 8-bit DirectClass 4.919MB 0.000u 0:00.000
Please, help....
Image newImage(sourceImage);
cout << progName << ": image opened" << endl;
if (!nothingToDo) {
cout << progName << ": 'conv.str()' is " << conv.str() << endl;
newImage.zoom(conv.str());
cout << progName << ": image zoomed by " << conv << endl;
}
The compile/link command is:
g++ -std=c++98 -W -Wall -O2 -DHOME="\"/Users/loreti\"" \
`Magick++-config --cppflags --cxxflags` -c -o prs.o prs.cxx
gcc -std=c99 -pedantic -W -Wall -O2 -DHOME="\"/Users/loreti\"" -c -o cutils.o cutils.c
g++ \
`Magick++-config --ldflags --libs` -o prs prs.o cutils.o
The program output is:
MLO@bigmac 26 $ ./prs -f ~/work -l mprs: end of command line processing.
From: "/Users/loreti/work"
To: "/Users/loreti/tmp"
Length: 768 pixels
Size: 500 kBytes
prs: skipped "."
prs: skipped ".."
prs: skipped ".DS_Store"
prs: inserted "IMG_3992.JPG"
prs: source "/Users/loreti/work", destination "/Users/loreti/tmp".
prs: image opened
prs: 'conv.str()' is 768x
prs(57402) malloc: *** error for object 0x8000000000000000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
Obviously there is an internal error in your library triggered by the statement newImage.zoom("768x").
The original image, copied to newImage for resining, is:
MLO@bigmac 27 $ identify ~/work/IMG_3992.JPG
/Users/loreti/work/IMG_3992.JPG JPEG 4353x3132 4353x3132+0+0 8-bit DirectClass 4.919MB 0.000u 0:00.000
Please, help....