summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-03 16:48:46 -0400
committerAnthony G. Basile <blueness@gentoo.org>2013-06-02 12:39:29 -0400
commitc7b0400c80c8a9fae2b58b38c38cfb7c5ac0220d (patch)
treed89600faa9ea48d7ec6255ea361babf5da242b12 /src
parent57f2c181f7daa9860221364de75f32e795da7e5b (diff)
udevadm-hwdb: avoid leak in error path
Diffstat (limited to 'src')
-rw-r--r--src/udev/udevadm-hwdb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
index 4f43953895..72e2ebccad 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: