# HG changeset patch # User tuomov # Date 1036289344 -3600 # Node ID 28628406763eb084619a9bc2e319d2e2b134ed5a # Parent 0a050a9536a17afce0cf086aae5e87e504b48113 trunk: changeset 44 remalloczero changes diff -r 0a050a9536a1 -r 28628406763e misc.c --- a/misc.c Mon May 27 00:27:30 2002 +0200 +++ b/misc.c Sun Nov 03 03:09:04 2002 +0100 @@ -28,22 +28,14 @@ void *p=NULL; if(newsize!=0){ - p=malloc(newsize); - + p=realloc(ptr, newsize); + if(p==NULL) return NULL; - memset(p, 0, newsize); - - if(newsizeoldsize) + memset(p+oldsize, 0, newsize-oldsize); } - - if(ptr!=NULL) - free(ptr); return p; }