forked from ariadne/pkgconf
libpkgconf: zero path lists after freeing
This is required to make the pointer safely re-usable after being freed, otherwise the list still says that it has nodes, but they point nowhere. This is particularly important for libpkgconf, if a caller needs to re-enter the library after freeing a path in a static path (such as the default personality)master
parent
2d201af326
commit
c0fa7879b2
|
@ -268,6 +268,8 @@ pkgconf_path_free(pkgconf_list_t *dirlist)
|
||||||
free(pnode->path);
|
free(pnode->path);
|
||||||
free(pnode);
|
free(pnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkgconf_list_zero(dirlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
|
|
@ -390,4 +390,6 @@ pkgconf_tuple_free(pkgconf_list_t *list)
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, next, node)
|
PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, next, node)
|
||||||
pkgconf_tuple_free_entry(node->data, list);
|
pkgconf_tuple_free_entry(node->data, list);
|
||||||
|
|
||||||
|
pkgconf_list_zero(list);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue