summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2012-10-28 04:59:38 +0100
committerKay Sievers <kay@vrfy.org>2012-10-28 04:59:38 +0100
commit9485d98d7741604c3d728edaed60b02ad63b71df (patch)
tree468bc357c1e98d4c2939fc799599b2ddd1ae680a /src
parent23b7245397ac3d21b2386e7b33d9e4ae3db3c8a1 (diff)
libudev: hwdb - cleanup list before getting new properties
Diffstat (limited to 'src')
-rw-r--r--src/libudev/libudev-hwdb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c
index a3f815f83f..8fe24a4320 100644
--- a/src/libudev/libudev-hwdb.c
+++ b/src/libudev/libudev-hwdb.c
@@ -338,10 +338,10 @@ _public_ struct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb) {
hwdb->refcount--;
if (hwdb->refcount > 0)
return hwdb;
- if (hwdb->f)
- fclose(hwdb->f);
if (hwdb->map)
munmap((void *)hwdb->map, hwdb->st.st_size);
+ if (hwdb->f)
+ fclose(hwdb->f);
udev_list_cleanup(&hwdb->properties_list);
free(hwdb);
return NULL;
@@ -382,6 +382,7 @@ _public_ struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev
return NULL;
}
+ udev_list_cleanup(&hwdb->properties_list);
err = trie_search_f(hwdb, modalias);
if (err < 0) {
errno = -err;