projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
124b368
)
hwdb: make trie_node_cleanup() can take NULL
author
Yu Watanabe
<watanabe.yu+github@gmail.com>
Tue, 18 Sep 2018 03:49:51 +0000
(12:49 +0900)
committer
Yu Watanabe
<watanabe.yu+github@gmail.com>
Wed, 19 Sep 2018 07:52:59 +0000
(16:52 +0900)
src/hwdb/hwdb.c
patch
|
blob
|
history
diff --git
a/src/hwdb/hwdb.c
b/src/hwdb/hwdb.c
index
ec96923
..
a2c1f7d
100644
(file)
--- a/
src/hwdb/hwdb.c
+++ b/
src/hwdb/hwdb.c
@@
-113,6
+113,9
@@
static struct trie_node *node_lookup(const struct trie_node *node, uint8_t c) {
static void trie_node_cleanup(struct trie_node *node) {
size_t i;
+ if (!node)
+ return;
+
for (i = 0; i < node->children_count; i++)
trie_node_cleanup(node->children[i].child);
free(node->children);
@@
-124,9
+127,7
@@
static void trie_free(struct trie *trie) {
if (!trie)
return;
- if (trie->root)
- trie_node_cleanup(trie->root);
-
+ trie_node_cleanup(trie->root);
strbuf_cleanup(trie->strings);
free(trie);
}