While checking memory leaks, buffer overflows using test_free, test_malloc, etc getting segmentation fault in the following case.
#ifdef UNITTEST
extern void* _test_malloc(const size_t size, const char* file, const int line);
extern void* _test_calloc(size_t nmemb, const size_t size, const char* file, const int line);
extern void* _test_realloc(void *ptr, const size_t size, const char* file, const int line);
extern void _test_free(void *ptr, const char* file, const int line);
#define malloc(size) _test_malloc(size, __FILE__, __LINE__)
#define calloc(nmemb,size) _test_calloc(nmemb, size, __FILE__, __LINE__)
#define realloc(ptr,size) _test_realloc(ptr, size, __FILE__, __LINE__)
#define free(ptr) _test_free(ptr, __FILE__, __LINE__)
#endif
#0 strlen () at ../sysdeps/i386/strlen.S:35
#1 0xf7bc3166 in _IO_vfprintf_internal (s=0xffffc7d0, format=0xf7d2c21e "%s:%u: error: Guard block of %p size=%lu is corrupt\n%s:%u: note: allocated here at %p\n", ap=0xffffcd58 "e-4c") at vfprintf.c:1643
#2 0xf7be5baf in _IO_vsnprintf (string=0xffffc8fc "src/config.c:49: error: Guard block of 0x8063010 size=943077171 is corrupt\n", maxlen=<optimized out>,
format=0xf7d2c21e "%s:%u: error: Guard block of %p size=%lu is corrupt\n%s:%u: note: allocated here at %p\n", args=0xffffcd44 "\377\204\005\b1") at vsnprintf.c:114
#3 0xf7d28421 in vcm_print_error (format=0xf7d2c21e "%s:%u: error: Guard block of %p size=%lu is corrupt\n%s:%u: note: allocated here at %p\n", args=0xffffcd44 "\377\204\005\b1")
at /home/sowri/cmocka-1.0.1_32/src/cmocka.c:1535
#4 0xf7d28957 in cm_print_error (format=0xf7d2c21e "%s:%u: error: Guard block of %p size=%lu is corrupt\n%s:%u: note: allocated here at %p\n")
at /home/sowri/cmocka-1.0.1_32/src/cmocka.c:1825
#5 0xf7d2a75b in _test_free (ptr=0x8063010, file=0x80584ff "src/config.c", line=49) at /home/sowri/cmocka-1.0.1_32/src/cmocka.c:1643
#6 0x0804a2b3 in config_reset (cfg=0x8060e20 <g_config>) at src/config.c:49
#7 0x0804cd0c in config_load (config_file=0x8058feb "/cfg/fwcm-updaterd.conf") at src/config.c:352
#8 0x0804f9e4 in test_config_load (state=0x80621a0) at unittest/config_ut.c:323
#9 0xf7d2aa9f in cmocka_run_one_test_or_fixture (function_name=0x805948b "test_config_load", test_func=0x804ee80 <test_config_load>, setup_func=setup_func@entry=0x0, teardown_func=0x0, state=<optimized out>, heap_check_point=0x0)
at /home/sowri/omc/cmocka-1.0.1_32/src/cmocka.c:2305
#10 0xf7d2b2c3 in cmocka_run_one_tests (test_state=0x8062198) at /home/sowri/omc/cmocka-1.0.1_32/src/cmocka.c:2413
#11 _cmocka_run_group_tests (group_name=0x805949c "tests", tests=0xffffd040, num_tests=3, group_setup=0x0, group_teardown=0x0) at /home/sowri//cmocka-1.0.1_32/src/cmocka.c:2518
#12 0x08052818 in main () at unittest/config_ut.c:85