Remove key and free attribute value only if they are valid,
authorwwp <wwp@free.fr>
Mon, 26 Mar 2018 12:01:26 +0000 (14:01 +0200)
committerwwp <wwp@free.fr>
Mon, 26 Mar 2018 12:01:26 +0000 (14:01 +0200)
clears CID 1220202.

src/plugins/perl/perl_plugin.c

index 3d68b8a..9c69566 100644 (file)
@@ -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);