mcelog: set n.meta to NULL after meta data is cleared.
authorKorynkevych, RomanX <romanx.korynkevych@intel.com>
Tue, 20 Jun 2017 15:02:29 +0000 (16:02 +0100)
committerTahhan, Maryam <maryam.tahhan@intel.com>
Thu, 6 Jul 2017 13:38:37 +0000 (14:38 +0100)
mcelog plugin got stuck after corrected and uncorrected memory errors injection.
This is caused due to pointing n.meta to unknown place in memory as n.meta
was not set to NULL after meta data has been cleared.

Change-Id: I81bdbeb43a9858f0071e1798e4d7a15423832a35
Signed-off-by: Korynkevych, RomanX <romanx.korynkevych@intel.com>
src/mcelog.c

index 865b0d1..072564b 100644 (file)
@@ -380,6 +380,7 @@ static int mcelog_dispatch_mem_notifications(const mcelog_memory_rec_t *mr) {
 
       if (n.meta)
         plugin_notification_meta_free(n.meta);
+        n.meta = NULL;
     }
   }
 
@@ -404,9 +405,9 @@ static int mcelog_dispatch_mem_notifications(const mcelog_memory_rec_t *mr) {
                sizeof(n.type_instance));
       n.severity = NOTIF_FAILURE;
       plugin_dispatch_notification(&n);
-
       if (n.meta)
         plugin_notification_meta_free(n.meta);
+        n.meta = NULL;
     }
   }