commit 65c35376f94c39d2b8ecbd1bc27ea6832ec4124b
parent 3561faa0d119de9b0169f9065cd10d3ac5ed2cdf
Author: wwp <wwp@free.fr>
Date: Mon, 26 Mar 2018 14:01:26 +0200
Remove key and free attribute value only if they are valid,
clears CID 1220202.
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/plugins/perl/perl_plugin.c b/src/plugins/perl/perl_plugin.c
@@ -430,10 +430,11 @@ static void insert_attribute_hash(gchar *attr)
if((tl = g_hash_table_lookup(attribute_hash,attr)) != NULL) {
gpointer origkey;
gpointer value;
- g_hash_table_lookup_extended(attribute_hash,attr,&origkey,&value);
- g_hash_table_remove(attribute_hash,origkey);
- free_attribute_hash_key(origkey,value,NULL);
- debug_print("Existing key `%s' freed.\n",attr);
+ if (g_hash_table_lookup_extended(attribute_hash,attr,&origkey,&value)) {
+ g_hash_table_remove(attribute_hash,origkey);
+ free_attribute_hash_key(origkey,value,NULL);
+ debug_print("Existing key `%s' freed.\n",attr);
+ }
}
tl = g_new0(PerlPluginTimedSList,1);