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 3d68b8ac812b63c0f939c9aa00a02fd46b223ad7..9c69566b8684d21e5612672d78987f4fdd0adbe2 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);