summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lockyer <thisisdaniellockyer@gmail.com>2017-11-24 10:31:49 +0000
committerDaniel Lockyer <thisisdaniellockyer@gmail.com>2017-11-24 10:31:49 +0000
commit5fecf46d76b31eedb3132cd569cfb82295e132bc (patch)
treedd579ee46b05041a9d7144db44106fe87b5bc6c4
parent71050acb68d2a86c823d561f83683c063b1a99a3 (diff)
downloadsystemd-5fecf46d76b31eedb3132cd569cfb82295e132bc.tar.gz
Replace free and return NULL with return mfree
-rw-r--r--src/basic/khash.c4
-rw-r--r--src/core/transaction.c3
-rw-r--r--src/libsystemd/sd-bus/bus-objects.c3
-rw-r--r--src/libudev/libudev-hwdb.c3
-rw-r--r--src/libudev/libudev-monitor.c3
-rw-r--r--src/libudev/libudev-queue.c3
-rw-r--r--src/libudev/libudev.c3
-rw-r--r--src/shared/condition.c3
-rw-r--r--src/shared/dissect-image.c3
-rw-r--r--src/shared/loop-util.c4
10 files changed, 10 insertions, 22 deletions
diff --git a/src/basic/khash.c b/src/basic/khash.c
index 8122903b09..694210512c 100644
--- a/src/basic/khash.c
+++ b/src/basic/khash.c
@@ -127,9 +127,7 @@ khash* khash_unref(khash *h) {
safe_close(h->fd);
free(h->algorithm);
- free(h);
-
- return NULL;
+ return mfree(h);
}
int khash_dup(khash *h, khash **ret) {
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 52ae664fae..32ad660026 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -346,8 +346,7 @@ static char* merge_unit_ids(const char* unit_log_field, char **pairs) {
STRV_FOREACH_PAIR(unit_id, job_type, pairs) {
next = strlen(unit_log_field) + strlen(*unit_id);
if (!GREEDY_REALLOC(ans, alloc, size + next + 1)) {
- free(ans);
- return NULL;
+ return mfree(ans);
}
sprintf(ans + size, "%s%s", unit_log_field, *unit_id);
diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
index 9fb455a94e..4c7dbaa2c9 100644
--- a/src/libsystemd/sd-bus/bus-objects.c
+++ b/src/libsystemd/sd-bus/bus-objects.c
@@ -1476,8 +1476,7 @@ static struct node *bus_node_allocate(sd_bus *bus, const char *path) {
r = hashmap_put(bus->nodes, n->path, n);
if (r < 0) {
free(n->path);
- free(n);
- return NULL;
+ return mfree(n);
}
if (parent)
diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c
index 5edb0bea7e..d2665278c1 100644
--- a/src/libudev/libudev-hwdb.c
+++ b/src/libudev/libudev-hwdb.c
@@ -113,8 +113,7 @@ _public_ struct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb) {
return NULL;
sd_hwdb_unref(hwdb->hwdb);
udev_list_cleanup(&hwdb->properties_list);
- free(hwdb);
- return NULL;
+ return mfree(hwdb);
}
/**
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index 3c9f1f9496..ca14373e19 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -493,8 +493,7 @@ _public_ struct udev_monitor *udev_monitor_unref(struct udev_monitor *udev_monit
close(udev_monitor->sock);
udev_list_cleanup(&udev_monitor->filter_subsystem_list);
udev_list_cleanup(&udev_monitor->filter_tag_list);
- free(udev_monitor);
- return NULL;
+ return mfree(udev_monitor);
}
/**
diff --git a/src/libudev/libudev-queue.c b/src/libudev/libudev-queue.c
index b1e41c086d..b941afb773 100644
--- a/src/libudev/libudev-queue.c
+++ b/src/libudev/libudev-queue.c
@@ -115,8 +115,7 @@ _public_ struct udev_queue *udev_queue_unref(struct udev_queue *udev_queue)
safe_close(udev_queue->fd);
- free(udev_queue);
- return NULL;
+ return mfree(udev_queue);
}
/**
diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c
index 475b94f913..64904c5ffa 100644
--- a/src/libudev/libudev.c
+++ b/src/libudev/libudev.c
@@ -136,8 +136,7 @@ _public_ struct udev *udev_unref(struct udev *udev) {
udev->refcount--;
if (udev->refcount > 0)
return udev;
- free(udev);
- return NULL;
+ return mfree(udev);
}
/**
diff --git a/src/shared/condition.c b/src/shared/condition.c
index 11555b474c..f1e914cb2d 100644
--- a/src/shared/condition.c
+++ b/src/shared/condition.c
@@ -78,8 +78,7 @@ Condition* condition_new(ConditionType type, const char *parameter, bool trigger
r = free_and_strdup(&c->parameter, parameter);
if (r < 0) {
- free(c);
- return NULL;
+ return mfree(c);
}
return c;
diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
index 08f1e98640..75e3431f28 100644
--- a/src/shared/dissect-image.c
+++ b/src/shared/dissect-image.c
@@ -648,8 +648,7 @@ DissectedImage* dissected_image_unref(DissectedImage *m) {
strv_free(m->machine_info);
strv_free(m->os_release);
- free(m);
- return NULL;
+ return mfree(m);
}
static int is_loop_device(const char *path) {
diff --git a/src/shared/loop-util.c b/src/shared/loop-util.c
index 31c5789a2e..097de690e5 100644
--- a/src/shared/loop-util.c
+++ b/src/shared/loop-util.c
@@ -152,9 +152,7 @@ LoopDevice* loop_device_unref(LoopDevice *d) {
}
free(d->node);
- free(d);
-
- return NULL;
+ return mfree(d);
}
void loop_device_relinquish(LoopDevice *d) {