]> git.deb.at Git - pkg/abook.git/commitdiff
- fix xfree
authorJaakko Heinonen <jheinonen@users.sourceforge.net>
Fri, 29 Jul 2005 05:53:10 +0000 (05:53 +0000)
committerJaakko Heinonen <jheinonen@users.sourceforge.net>
Fri, 29 Jul 2005 05:53:10 +0000 (05:53 +0000)
edit.c
xmalloc.c
xmalloc.h

diff --git a/edit.c b/edit.c
index 7a4004a71ffd60342a81008ca7b724b15c95d2da..ebabf1a2fdf2ac100817a64c9b29756e10f7dc70 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -227,7 +227,7 @@ change_field(char *msg, char **field)
        *field = ui_readline(msg, old, max_len - 1, 0);
 
        if(*field) {
-               free(old);
+               xfree(old);
                if(!**field)
                        xfree(*field);
        } else {
index bc22a97b19faa6867ee9f8535a5b0ea52d3e2a3b..e76758488059fb4c1c7f57faea2996e8a2e6963e 100644 (file)
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -134,10 +134,3 @@ xrealloc_inc(void *ptr, size_t size, size_t inc)
        return ptr;
 }
 
-void
-xfree(void *ptr)
-{
-       free(ptr);
-       ptr = NULL;
-}
-
index c6c5317599619153ee9afcd273c2362b7aeb115d..61e25c2283f35179e88f60fdc486c74be9a7d042 100644 (file)
--- a/xmalloc.h
+++ b/xmalloc.h
@@ -9,6 +9,7 @@ void *          xmalloc0(size_t);
 void *         xmalloc_inc(size_t, size_t);
 void *         xrealloc(void *, size_t);
 void *         xrealloc_inc(void *, size_t, size_t);
-void           xfree(void *);
+
+#define xfree(ptr)     do { free(ptr); ptr = NULL; } while(0)
 
 #endif