From 398e756263502a98a0c1887dcf38f7ef1fafa84b Mon Sep 17 00:00:00 2001 From: Vasilii Chernov Date: Mon, 15 Feb 2016 13:41:25 +0100 Subject: Fix memory leaks Add GIL states for int pcilib_script_read and pcilib_script_write functions Correct desctructor for create_pcilib_instance return object --- pcilib/property.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'pcilib/property.c') diff --git a/pcilib/property.c b/pcilib/property.c index a7d1a61..3a7ebb3 100644 --- a/pcilib/property.c +++ b/pcilib/property.c @@ -165,7 +165,6 @@ pcilib_property_info_t *pcilib_get_property_list(pcilib_t *ctx, const char *bran continue; } - dir = (struct dir_hash_s*)malloc(sizeof(struct dir_hash_s)); if (!dir) { err = PCILIB_ERROR_MEMORY; @@ -226,6 +225,12 @@ pcilib_property_info_t *pcilib_get_property_list(pcilib_t *ctx, const char *bran }; } + + + HASH_ITER(hh, dir_hash, dir, dir_tmp) { + HASH_DEL(dir_hash, dir); + free(dir); + } HASH_CLEAR(hh, dir_hash); memset(&info[pos], 0, sizeof(pcilib_property_info_t)); -- cgit v1.2.3