summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/copy.c6
-rw-r--r--src/basic/util.h5
2 files changed, 7 insertions, 4 deletions
diff --git a/src/basic/copy.c b/src/basic/copy.c
index e2d356d676..33427c6a73 100644
--- a/src/basic/copy.c
+++ b/src/basic/copy.c
@@ -467,8 +467,7 @@ int copy_xattr(int fdf, int fdt) {
sza *= 2;
- free(bufa);
- bufa = NULL;
+ bufa = mfree(bufa);
}
p = bufa;
@@ -491,8 +490,7 @@ int copy_xattr(int fdf, int fdt) {
if (m < 0) {
if (errno == ERANGE) {
szb *= 2;
- free(bufb);
- bufb = NULL;
+ bufb = mfree(bufb);
continue;
}
diff --git a/src/basic/util.h b/src/basic/util.h
index 05ddf14780..88c44273d4 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -85,6 +85,11 @@ int strcmp_ptr(const char *a, const char *b) _pure_;
#define malloc0(n) (calloc((n), 1))
+static inline void *mfree(void *memory) {
+ free(memory);
+ return NULL;
+}
+
static inline const char* yes_no(bool b) {
return b ? "yes" : "no";
}