]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: initialize hwdb so that the test won't try to free memory it has never allocated
authorEvgeny Vereshchagin <evvers@ya.ru>
Wed, 7 Nov 2018 22:24:16 +0000 (23:24 +0100)
committerEvgeny Vereshchagin <evvers@ya.ru>
Thu, 8 Nov 2018 12:49:45 +0000 (13:49 +0100)
See https://github.com/systemd/systemd/pull/10678#issuecomment-436790906.

src/test/test-sd-hwdb.c

index b67a8537bf34ea27087d12ca230ef9deb2a4cb49..17ca6a0e279861e5305f595a6dfa1d41b16846df 100644 (file)
@@ -5,7 +5,7 @@
 #include "tests.h"
 
 static int test_failed_enumerate(void) {
-        _cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb;
+        _cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb = NULL;
         const char *key, *value;
         int r;
 
@@ -29,7 +29,7 @@ static int test_failed_enumerate(void) {
         "evdev:atkbd:dmi:bvnXXX:bvrYYY:bdZZZ:svnDellXXX:pnYYY"
 
 static void test_basic_enumerate(void) {
-        _cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb;
+        _cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb = NULL;
         const char *key, *value;
         size_t len1 = 0, len2 = 0;
         int r;