Fix leaks and invalid memory accesses
[lttv.git] / lttv / lttv / sync / sync_chain_unittest.c
index 9b4b869c7f32bac3b622ac71a115e05050b7aaee..5d475ea8008f97c15d4ff548185a7d0ec842b109 100644 (file)
@@ -98,6 +98,7 @@ int main(const int argc, char* const argv[])
        bool stats;
        const char* testCaseName;
        GString* analysisModulesNames;
+       unsigned int id;
 
        // Initialize data structures
        syncState= malloc(sizeof(SyncState));
@@ -137,7 +138,7 @@ int main(const int argc, char* const argv[])
        else
        {
                syncState->stats= false;
-               g_log_set_handler(NULL, G_LOG_LEVEL_DEBUG, nullLog, NULL);
+               id= g_log_set_handler(NULL, G_LOG_LEVEL_DEBUG, nullLog, NULL);
        }
 
        if (optionSyncGraphs.present)
@@ -227,6 +228,11 @@ int main(const int argc, char* const argv[])
                        endUsage.ru_stime.tv_usec);
        }
 
+       if (!optionSyncStats.present)
+       {
+               g_log_remove_handler(NULL, id);
+       }
+
        return EXIT_SUCCESS;
 }
 
This page took 0.024438 seconds and 4 git commands to generate.