diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-04-03 16:48:46 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-04-04 22:46:19 -0400 |
commit | ff03aed06a42235a87a3d33e7d812be1e9c8161d (patch) | |
tree | e40460f39797890e9c02c9e9fbc9e78828de85f5 | |
parent | 5483a18693871e67cff6d85e43ca843cd976d019 (diff) |
udevadm-hwdb: avoid leak in error path
-rw-r--r-- | src/udev/udevadm-hwdb.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index a2df291a40..1e80b0d611 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -176,11 +176,11 @@ static int trie_insert(struct trie *trie, struct trie_node *node, const char *se const char *key, const char *value) { size_t i = 0; int err = 0; + struct trie_node _cleanup_free_ *child = NULL; for (;;) { size_t p; uint8_t c; - struct trie_node *child; for (p = 0; (c = trie->strings->buf[node->prefix_off + p]); p++) { char *s; @@ -254,6 +254,7 @@ static int trie_insert(struct trie *trie, struct trie_node *node, const char *se } node = child; + child = NULL; /* avoid cleanup */ i++; } out: |