[libgweather] tests: Fix uninitialised value



commit 7b9add5edfd84b5017711ca1dc45d75ed4a7ffa0
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Dec 12 18:04:34 2017 +0100

    tests: Fix uninitialised value
    
    Conditional jump or move depends on uninitialised value(s)
       at 0x401C1F: parse_metar_stations (test_libgweather.c:211)
       by 0x401F6E: test_metar_weather_stations (test_libgweather.c:284)
       by 0x532E139: test_case_run (gtestutils.c:2231)
       by 0x532E139: g_test_run_suite_internal (gtestutils.c:2315)
       by 0x532E06A: g_test_run_suite_internal (gtestutils.c:2327)
       by 0x532E301: g_test_run_suite (gtestutils.c:2402)
       by 0x532E320: g_test_run (gtestutils.c:1668)
       by 0x402360: main (test_libgweather.c:392)
     Uninitialised value was created by a stack allocation
       at 0x401A72: parse_metar_stations (test_libgweather.c:170)

 libgweather/test_libgweather.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/libgweather/test_libgweather.c b/libgweather/test_libgweather.c
index 9d04e6d..ef72dc8 100644
--- a/libgweather/test_libgweather.c
+++ b/libgweather/test_libgweather.c
@@ -173,6 +173,7 @@ parse_metar_stations (const char *contents)
     guint i, num_stations;
 
     stations_ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+    num_stations = 0;
     lines = g_strsplit (contents, "\n", -1);
 
     for (i = 0; lines[i] != NULL; i++) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]