]> git.ozlabs.org Git - ccan/blobdiff - talloc/talloc.c
First cut of hashing routines.
[ccan] / talloc / talloc.c
index 17bb0ec8cc5f3f230615a3514f2e2c4e3b578e5a..d624b9174dde42b8e892fb5764cb9544bd249671 100644 (file)
@@ -34,6 +34,7 @@
 #include "talloc.h"
 #include <string.h>
 #include <stdint.h>
 #include "talloc.h"
 #include <string.h>
 #include <stdint.h>
+#include <errno.h>
 
 /* use this to force every realloc to change the pointer, to stress test
    code that might not cope */
 
 /* use this to force every realloc to change the pointer, to stress test
    code that might not cope */
@@ -730,7 +731,11 @@ void *talloc_named_const(const void *context, size_t size, const char *name)
 */
 int talloc_free(void *ptr)
 {
 */
 int talloc_free(void *ptr)
 {
-       return _talloc_free(ptr);
+       int saved_errno = errno, ret;
+       ret = _talloc_free(ptr);
+       if (ret == 0)
+               errno = saved_errno;
+       return ret;
 }
 
 
 }