summaryrefslogtreecommitdiff
path: root/src/libudev/libudev-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libudev/libudev-list.c')
-rw-r--r--src/libudev/libudev-list.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/libudev/libudev-list.c b/src/libudev/libudev-list.c
index da496ed456..0d51322a15 100644
--- a/src/libudev/libudev-list.c
+++ b/src/libudev/libudev-list.c
@@ -166,17 +166,16 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *
entry = new0(struct udev_list_entry, 1);
if (entry == NULL)
return NULL;
+
entry->name = strdup(name);
- if (entry->name == NULL) {
- free(entry);
- return NULL;
- }
+ if (entry->name == NULL)
+ return mfree(entry);
+
if (value != NULL) {
entry->value = strdup(value);
if (entry->value == NULL) {
free(entry->name);
- free(entry);
- return NULL;
+ return mfree(entry);
}
}
@@ -193,8 +192,7 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *
if (entries == NULL) {
free(entry->name);
free(entry->value);
- free(entry);
- return NULL;
+ return mfree(entry);
}
list->entries = entries;
list->entries_max += add;