summaryrefslogtreecommitdiffstats
path: root/src/xdg-autostart-generator/test-xdg-autostart.c
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2023-05-23 13:25:58 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2023-05-23 20:45:27 +0200
commit3d41b6b8e864abbf7b81c938532f42e97a900e22 (patch)
treea165aba13bdc0d7c0d3d6399292eefcdba834b65 /src/xdg-autostart-generator/test-xdg-autostart.c
parentjson: correctly handle magic strings when parsing variant strv (diff)
downloadsystemd-3d41b6b8e864abbf7b81c938532f42e97a900e22.tar.xz
systemd-3d41b6b8e864abbf7b81c938532f42e97a900e22.zip
tree-wide: Fix false positives on newer gcc
Recent gcc versions have started to trigger false positive maybe-uninitialized warnings. Let's make sure we initialize variables annotated with _cleanup_ to avoid these.
Diffstat (limited to 'src/xdg-autostart-generator/test-xdg-autostart.c')
-rw-r--r--src/xdg-autostart-generator/test-xdg-autostart.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/xdg-autostart-generator/test-xdg-autostart.c b/src/xdg-autostart-generator/test-xdg-autostart.c
index e11f3d9385..81f85d6b15 100644
--- a/src/xdg-autostart-generator/test-xdg-autostart.c
+++ b/src/xdg-autostart-generator/test-xdg-autostart.c
@@ -10,7 +10,7 @@
#include "xdg-autostart-service.h"
TEST(translate_name) {
- _cleanup_free_ char *t;
+ _cleanup_free_ char *t = NULL;
assert_se(t = xdg_autostart_service_translate_name("a-b.blub.desktop"));
assert_se(streq(t, "app-a\\x2db.blub@autostart.service"));
@@ -26,7 +26,7 @@ static void test_xdg_format_exec_start_one(const char *exec, const char *expecte
TEST(xdg_format_exec_start) {
_cleanup_free_ char *home = NULL;
- _cleanup_free_ char *expected1, *expected2 = NULL;
+ _cleanup_free_ char *expected1 = NULL, *expected2 = NULL;
assert_se(get_home_dir(&home) >= 0);