Subject: memleak in printf?
To: None <netbsd-users@netbsd.org>
From: Piotr Meyer <aniou@smutek.pl>
List: netbsd-users
Date: 04/18/2006 21:33:13
Recently I played with DUMA library - fork of well known Electric Fence
lib (http://duma.sourceforge.net/). Now, I'm siuprised by small test:
$ cat test.c
#include <stdlib.h>
#include <duma.h>
#include <stdio.h>
#include <stdarg.h>
int main(void) {
int result = 10;
printf("%i\n", result);
return(EXIT_SUCCESS);
}
[ compiling and linking again duma shared library ]
$ ./test
DUMA 2.4.26 (shared library)
Copyright (C) 2002-2005 Hayati Ayguen <h_ayguen@web.de>, Procitec GmbH
Copyright (C) 1987-1999 Bruce Perens <bruce@perens.com>
10
DUMA: ptr=0xbd715000 size=65536 alloced from UNKNOWN (use #include "duma.h")(0) not freed
DUMA Aborting: DUMA_delFrame(): Found non free'd pointers.
Illegal instruction (core dumped)
$ gdb test test.core
[snip]
#0 0xbdb3583b in kill () from /usr/lib/libc.so.12
(gdb) bt
#0 0xbdb3583b in kill () from /usr/lib/libc.so.12
#1 0xbdbe7881 in DUMA_Abort (pattern=0xbdbe8680 "DUMA_delFrame(): Found non free'd pointers.\n") at print.c:282
#2 0xbdbe7177 in DUMA_delFrame () at duma.c:1604
#3 0xbdbe71ee in _duma_exit () at duma.c:1629
#4 0xbdbe3b8b in __do_global_dtors_aux () from /home/users/aniou/projekty/nss/libduma.so
#5 0xbdbe7a05 in fini_fallthru () from /home/users/aniou/projekty/nss/libduma.so
#6 0xbdbf5988 in _rtld_call_fini_functions () from /usr/libexec/ld.elf_so
#7 0xbdba3e30 in exit () from /usr/lib/libc.so.12
#8 0x080485d2 in ___start ()
(gdb)
I tested longer program - simple cgetfirst/cgetnext parser and, without
printf function, DUMA works well... Any ideas?
PS. I made test on Linux (Ubuntu 5.10 with kernel 2.6.12) without any
warnings/errors.
--
Piotr 'aniou' Meyer