chiark / gitweb /
coredumpctl: fix potential deref of null pointer
[elogind.git] / src / journal / coredumpctl.c
index ce6159d62c2c42713fbd14846761d5f68940e2a1..2158d7377194eedb6cd961eda53a88d25538dc91 100644 (file)
@@ -601,8 +601,10 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
         }
 
         if (filename && !endswith(filename, ".xz")) {
-                *path = filename;
-                filename = NULL;
+                if (path) {
+                        *path = filename;
+                        filename = NULL;
+                }
 
                 return 0;
         } else {
@@ -718,8 +720,7 @@ static int dump_core(sd_journal* j) {
 }
 
 static int run_gdb(sd_journal *j) {
-
-        _cleanup_free_ char *exe = NULL, *coredump = NULL, *path = NULL;
+        _cleanup_free_ char *exe = NULL, *path = NULL;
         bool unlink_path = false;
         const char *data;
         siginfo_t st;