free() in malloc.c
Kate Feng
feng1 at bnl.gov
Wed Nov 8 18:01:38 UTC 2006
Does the following patch make sense since the free(void *ptr)
of malloc.c checks for the :
>if ( !ptr )
> return;
It seems that ptr is not reset to zero by the OS if
free() is successful. I thought it's better to have
the OS to reset the ptr to be zero if free() is successful.
What do you think ? Kate
diff -c -u cpukit/libcsupport/src/malloc.c.orig
cpukit/libcsupport/src/malloc.c
--- cpukit/libcsupport/src/malloc.c.orig Thu May 25 13:36:31 2006
+++ cpukit/libcsupport/src/malloc.c Fri Nov 3 12:49:37 2006
@@ -496,6 +496,8 @@
errno = EINVAL;
assert( 0 );
}
+ else
+ ptr = 0;
}
More information about the users
mailing list