diff options
-rw-r--r-- | src/collect/collect.c | 1 | ||||
-rw-r--r-- | src/udev/udevadm-hwdb.c | 5 | ||||
-rw-r--r-- | src/udev/udevd.c | 3 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/collect/collect.c b/src/collect/collect.c index 834e27683c..e938d41728 100644 --- a/src/collect/collect.c +++ b/src/collect/collect.c @@ -453,6 +453,7 @@ int main(int argc, char **argv) him->name = malloc(strlen(argv[i]) + 1); if (!him->name) { + free(him); /* clang reported memleak ; him is thrown away here */ ret = ENOMEM; goto out; } diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index ea21f242ae..f5fd7e21f2 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -207,6 +207,7 @@ static int trie_insert(struct trie *trie, struct trie_node *node, const char *se return -ENOMEM; off = strbuf_add_string(trie->strings, s, p); + free(s); /* fix clang-reported potential memleak */ if (off < 0) return off; @@ -303,8 +304,10 @@ static int64_t trie_store_nodes(struct trie_f *trie, struct trie_node *node) { int64_t child_off; child_off = trie_store_nodes(trie, node->children[i].child); - if (child_off < 0) + if (child_off < 0) { + free(children); /* clang reported memleak , children is thrown away if this fails */ return child_off; + } children[i].c = node->children[i].c; children[i].child_off = htole64(child_off); } diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 44318814c9..a923ce740b 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -162,6 +162,7 @@ static void worker_cleanup(struct worker *worker) udev_monitor_unref(worker->monitor); children--; free(worker); + worker = NULL; } static void worker_unref(struct worker *worker) @@ -1308,7 +1309,7 @@ int main(int argc, char *argv[]) worker->state = WORKER_KILLED; /* drop reference taken for state 'running' */ worker_unref(worker); - if (worker->event) { + if (worker && worker->event) { log_error("seq %llu '%s' killed\n", udev_device_get_seqnum(worker->event->dev), worker->event->devpath); worker->event->exitcode = -64; |