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:
parent
71050acb68
commit
5fecf46d76
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user