Fix: potential NULL dereference of ctf_fs_file path
[babeltrace.git] / plugins / ctf / fs-src / file.c
index 0d0ed7e0a21ddb66143260b05920c815028def25..61a724b01fb18a8953b3d5e73692812fe84b76e8 100644 (file)
@@ -45,11 +45,13 @@ void ctf_fs_file_destroy(struct ctf_fs_file *file)
        ctf_fs = file->ctf_fs;
 
        if (file->fp) {
-               PDBG("Closing file \"%s\" (%p)\n", file->path->str, file->fp);
+               PDBG("Closing file \"%s\" (%p)\n",
+                               file->path ? file->path->str : NULL, file->fp);
 
                if (fclose(file->fp)) {
-                       PERR("Cannot close file \"%s\": %s\n", file->path->str,
-                               strerror(errno));
+                       PERR("Cannot close file \"%s\": %s\n",
+                                       file->path ? file->path->str : "NULL",
+                                       strerror(errno));
                }
        }
 
This page took 0.024076 seconds and 4 git commands to generate.