1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 16:21:26 +03:00

Replace free and return NULL with return mfree

This commit is contained in:
Daniel Lockyer 2017-11-24 10:31:49 +00:00
parent 71050acb68
commit 5fecf46d76
10 changed files with 10 additions and 22 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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)

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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;

View File

@ -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) {

View File

@ -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) {