"corrupted double-linked list" error from glibc
Posted: 2009-04-23T13:34:38-07:00
I'm currently developing a library that uses Magick (C) for I/0. I have 2 executables using it: one is a C program and the other is a C++ one.
From the C program, I/O always works like a charm. But starting today, my C++ program crashes when using a function that writes an image (written in C).
The odd thing is that , yesterday it was working perfectly. Another odd thing is, always get this error on the 4th invocation of the function. I have several invocations (like 10) and when I remove the one that gives problem, the next invocation crashes.
Below I post the function and the error. imatge_rgba is my image type, the aim of the function is just to write it to disk.
The functions code:
The error I get is the following:
Thanks in advance for your help.
From the C program, I/O always works like a charm. But starting today, my C++ program crashes when using a function that writes an image (written in C).
The odd thing is that , yesterday it was working perfectly. Another odd thing is, always get this error on the 4th invocation of the function. I have several invocations (like 10) and when I remove the one that gives problem, the next invocation crashes.
Below I post the function and the error. imatge_rgba is my image type, the aim of the function is just to write it to disk.
The functions code:
Code: Select all
#include <magick/api.h>
#include <string.h>
void imatge_rgba_save_magick(imatge_rgba *o, const char* filename)
{
XML_IN;
Image * image;
ImageInfo *image_info;
//MagickCoreGenesis(".",MagickTrue);
InitializeMagick(NULL);
image_info=CloneImageInfo((ImageInfo *) NULL);
//image_info=AcquireImageInfo();
//GetImageInfo(image_info);
image_info->depth=8;
image=AllocateImage(image_info);
if (image == (Image *) NULL)
MagickError(ResourceLimitError,"Unable to save image",
"Memory allocation failed");
strcpy( image_info->filename, filename );
strcpy(image->filename, filename );
image -> rows = (int)o->h;
image -> columns = (int)o->w;
image->depth=8;
PixelPacket *q;
float f=65535.0/255.0;
//float f=1;
rgba_value v;
for(int i=0;i<o->h;i++)
for(int j=0;j<o->w;j++)
+--- 14 lines: {------------------------------------------------------------------------------------------------------
SyncImagePixels(image);
WriteImage(image_info,image);
//DestroyImage(image);
//DestroyImageInfo(image_info);
XML_OUT;
}
Code: Select all
*** glibc detected *** tor_compute_meaningful_mergings_4: corrupted double-linked list: 0x082eb9d8 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb76cf454]
/lib/tls/i686/cmov/libc.so.6[0xb76d24d2]
/lib/tls/i686/cmov/libc.so.6(__libc_malloc+0x95)[0xb76d38c5]
/usr/lib/libMagick.so.10(AcquireMagickMemory+0x23)[0xb7a8db63]
/usr/lib/libMagick.so.10(AcquireImageInfo+0x23)[0xb7a7b7c3]
/usr/lib/libMagick.so.10(CloneImageInfo+0x1c)[0xb7a7b87c]
tor_compute_meaningful_mergings_4[0x80746bf]
tor_compute_meaningful_mergings_4[0x804ed6b]
tor_compute_meaningful_mergings_4[0x8050726]
tor_compute_meaningful_mergings_4[0x8052b82]
tor_compute_meaningful_mergings_4[0x8053b72]
tor_compute_meaningful_mergings_4[0x804c86c]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7676685]
tor_compute_meaningful_mergings_4[0x804c631]
======= Memory map: ========
08048000-0810c000 r-xp 00000000 08:03 140364 /home/juan/juanc/develop/tmaps/trunk/bin/tor_compute_meaningful_mergings_4
0810c000-0810d000 r--p 000c3000 08:03 140364 /home/juan/juanc/develop/tmaps/trunk/bin/tor_compute_meaningful_mergings_4
0810d000-08266000 rw-p 000c4000 08:03 140364 /home/juan/juanc/develop/tmaps/trunk/bin/tor_compute_meaningful_mergings_4
08266000-08267000 rw-p 08266000 00:00 0
082cf000-085bf000 rw-p 082cf000 00:00 0 [heap]
b4ce2000-b4d54000 rw-p b4ce2000 00:00 0
b4e38000-b4f66000 rw-p b4e38000 00:00 0
b5100000-b5121000 rw-p b5100000 00:00 0
b5121000-b5200000 ---p b5121000 00:00 0
b5284000-b544c000 rw-p b5284000 00:00 0
b544c000-b5498000 rw-s 00000000 00:09 53020 /dev/zero (deleted)
b5498000-b54e4000 rw-s 00000000 00:09 53015 /dev/zero (deleted)
b54e4000-b562e000 rw-p b54e4000 00:00 0
b562e000-b567a000 rw-s 00000000 00:09 53005 /dev/zero (deleted)
b567a000-b569e000 r-xp 00000000 08:01 156921 /usr/lib/libpng12.so.0.27.0
b569e000-b569f000 r--p 00023000 08:01 156921 /usr/lib/libpng12.so.0.27.0
b569f000-b56a0000 rw-p 00024000 08:01 156921 /usr/lib/libpng12.so.0.27.0
b56b8000-b56d3000 r-xp 00000000 08:01 179361 /usr/lib/ImageMagick-6.3.7/modules-Q16/coders/png.so
b56d3000-b56d4000 r--p 0001a000 08:01 179361 /usr/lib/ImageMagick-6.3.7/modules-Q16/coders/png.so
b56d4000-b56d5000 rw-p 0001b000 08:01 179361 /usr/lib/ImageMagick-6.3.7/modules-Q16/coders/png.so
b56d5000-b73e9000 rw-p b56d5000 00:00 0
b73e9000-b73ed000 r-xp 00000000 08:01 156246 /usr/lib/libXdmcp.so.6.0.0
b73ed000-b73ee000 rw-p 00003000 08:01 156246 /usr/lib/libXdmcp.so.6.0.0
b73ee000-b7405000 r-xp 00000000 08:01 157399 /usr/lib/libxcb.so.1.0.0
b7405000-b7406000 r--p 00016000 08:01 157399 /usr/lib/libxcb.so.1.0.0
b7406000-b7407000 rw-p 00017000 08:01 157399 /usr/lib/libxcb.so.1.0.0
b7407000-b7408000 rw-p b7407000 00:00 0
b7408000-b7409000 r-xp 00000000 08:01 157395 /usr/lib/libxcb-xlib.so.0.0.0
b7409000-b740a000 r--p 00000000 08:01 157395 /usr/lib/libxcb-xlib.so.0.0.0
b740a000-b740b000 rw-p 00001000 08:01 157395 /usr/lib/libxcb-xlib.so.0.0.0
b740b000-b742f000 r-xp 00000000 08:01 156474 /usr/lib/libexpat.so.1.5.2
b742f000-b7431000 r--p 00023000 08:01 156474 /usr/lib/libexpat.so.1.5.2
b7431000-b7432000 rw-p 00025000 08:01 156474 /usr/lib/libexpat.so.1.5.2
b7432000-b7439000 r-xp 00000000 08:01 91403 /lib/tls/i686/cmov/librt-2.8.90.so
b7439000-b743a000 r--p 00007000 08:01 91403 /lib/tls/i686/cmov/librt-2.8.90.so
b743a000-b743b000 rw-p 00008000 08:01 91403 /lib/tls/i686/cmov/librt-2.8.90.so
b743b000-b743d000 r-xp 00000000 08:01 156235 /usr/lib/libXau.so.6.0.0
b743d000-b743e000 rw-p 00001000 08:01 156235 /usr/lib/libXau.so.6.0.0
b743e000-b744b000 r-xp 00000000 08:01 75802 /lib/libgcc_s.so.1
b744b000-b744c000 r--p 0000c000 08:01 75802 /lib/libgcc_s.so.1
b744c000-b744d000 rw-p 0000d000 08:01 75802 /lib/libgcc_s.so.1
b744d000-b744e000 rw-p b744d000 00:00 0
b744e000-b7539000 r-xp 00000000 08:01 155494 /usr/lib/libX11.so.6.2.0
b7539000-b753a000 r--p 000ea000 08:01 155494 /usr/lib/libX11.so.6.2.0
b753a000-b753c000 rw-p 000eb000 08:01 155494 /usr/lib/libX11.so.6.2.0
b753c000-b753d000 rw-p b7Aborted