yml: yml_destroy(): return immediately if node is NULL

This can happen for example when destroying a partially created
dictionary entry, where only the key node has been created.
This commit is contained in:
Daniel Eklöf 2019-01-01 23:24:27 +01:00
parent a9110cc936
commit 3dc7d0e39d

3
yml.c
View file

@ -365,6 +365,9 @@ yml_load(FILE *yml)
void void
yml_destroy(struct yml_node *node) yml_destroy(struct yml_node *node)
{ {
if (node == NULL)
return;
switch (node->type) { switch (node->type) {
case ROOT: case ROOT:
yml_destroy(node->root.root); yml_destroy(node->root.root);