Description of problem: multiple log4c_init and log4c_fini in the same program generate a "double free or corruption error" Version-Release number of selected component (if applicable): log4c-devel-1.2.4-1.fc20.x86_64 gcc-c++-4.8.2-7.fc20.x86_64 How reproducible: by compiling and running attached bad-log4c.cpp Steps to Reproduce: 1. download the attachment 2. compile it with: g++ `log4c-config --cflags --libs` bad-log4c.cpp 3. run the resulting a.out Actual results: $ ./a.out *** Error in `./a.out': double free or corruption (!prev): 0x0000000001f96040 *** ======= Backtrace: ========= /lib64/libc.so.6[0x3ece475cff] /lib64/libc.so.6[0x3ece47cff8] /lib64/liblog4c.so.3(sd_hash_lookadd+0x16d)[0x35f260b18d] /lib64/liblog4c.so.3(log4c_layout_type_set+0x21)[0x35f26087b1] /lib64/liblog4c.so.3(log4c_init+0x5c)[0x35f260703c] ./a.out[0x400713] /lib64/libc.so.6(__libc_start_main+0xf5)[0x3ece421d65] ./a.out[0x400639] Expected results: no errors Additional info:
Created attachment 893311 [details] cpp source triggering the bug
Thanks for the report. The problem is with the usage of local static variables, in this case in layout.c (although the similar approach is used on more places there): static sd_hash_t* log4c_layout_types(void) { static sd_hash_t* types = NULL; if (!types) types = sd_hash_new(20, NULL); return types; } extern void log4c_layout_types_free( void ) { sd_hash_t * types = log4c_layout_types(); if ( types != NULL ) { sd_hash_delete( types ); } }
log4c-1.2.4-2.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/log4c-1.2.4-2.fc20
log4c-1.2.4-2.fc19 has been submitted as an update for Fedora 19. https://admin.fedoraproject.org/updates/log4c-1.2.4-2.fc19
Package log4c-1.2.4-2.fc20: * should fix your issue, * was pushed to the Fedora 20 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing log4c-1.2.4-2.fc20' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-6149/log4c-1.2.4-2.fc20 then log in and leave karma (feedback).
Thank you very much for the quick response. I just updated log4c and log4c-devel 1.2.4-2.fc20 from the testing repository, the attached source seems to be working now $ g++ `log4c-config --cflags --libs` bad-log4c.cpp $ ./a.out $ echo $? 0
log4c-1.2.4-2.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.
log4c-1.2.4-2.fc19 has been pushed to the Fedora 19 stable repository. If problems still persist, please make note of it in this bug report.