Subject: memleak in printf?
To: None <>
From: Piotr Meyer <>
List: netbsd-users
Date: 04/18/2006 21:33:13
Recently I played with DUMA library - fork of well known Electric Fence
lib ( 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);

[ compiling and linking again duma shared library ]

$ ./test
DUMA 2.4.26 (shared library)
Copyright (C) 2002-2005 Hayati Ayguen <>, Procitec GmbH
Copyright (C) 1987-1999 Bruce Perens <>


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
#0  0xbdb3583b in kill () from /usr/lib/
(gdb) bt
#0  0xbdb3583b in kill () from /usr/lib/
#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/
#5  0xbdbe7a05 in fini_fallthru () from /home/users/aniou/projekty/nss/
#6  0xbdbf5988 in _rtld_call_fini_functions () from /usr/libexec/ld.elf_so
#7  0xbdba3e30 in exit () from /usr/lib/
#8  0x080485d2 in ___start ()

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

Piotr 'aniou' Meyer