Ignore:
Timestamp:
Jun 10, 2008, 6:21:17 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • Do not try to free() on buffers that have been allocated with the real malloc, or we may crash unexpectedly, for instance if dlsym("free") calls malloc() then free() while free hasn't been loaded yet.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/lib-mem.c

    r1791 r2354  
    111111void _zz_mem_init(void)
    112112{
     113    LOADSYM(free);
    113114    LOADSYM(calloc);
    114115    LOADSYM(malloc);
     
    157158        return;
    158159    }
    159     LOADSYM(free);
     160    if(!ORIG(free))
     161    {
     162        /* FIXME: memory leak */
     163        debug("%s(%p) IGNORED", __func__, ptr);
     164        return;
     165    }
    160166    ORIG(free)(ptr);
    161167}
Note: See TracChangeset for help on using the changeset viewer.