Cleanup: remove logically dead code
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 26 Jul 2017 17:21:43 +0000 (13:21 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 9 Aug 2017 19:19:41 +0000 (15:19 -0400)
Found by Coverity:

null: At condition fp, the value of fp must be NULL.
dead_error_condition: The condition fp cannot be true.

CID 1376173 (#1 of 1): Logically dead code (DEADCODE)dead_error_begin:
Execution cannot reach this statement: fclose(fp);

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
plugins/ctf/fs-src/metadata.c

index 383944c4011fce9515d62e63cfb06677e8648d55..6ae43df90212d7773d3bf26d0902ff92a62bfe2b 100644 (file)
 BT_HIDDEN
 FILE *ctf_fs_metadata_open_file(const char *trace_path)
 {
-       GString *metadata_path = g_string_new(trace_path);
+       GString *metadata_path;
        FILE *fp = NULL;
 
+       metadata_path = g_string_new(trace_path);
        if (!metadata_path) {
-               goto error;
+               goto end;
        }
 
        g_string_append(metadata_path, "/" CTF_FS_METADATA_FILENAME);
        fp = fopen(metadata_path->str, "rb");
-       if (!fp) {
-               goto error;
-       }
-
-       goto end;
-
-error:
-       if (fp) {
-               fclose(fp);
-               fp = NULL;
-       }
-
-end:
        g_string_free(metadata_path, TRUE);
+end:
        return fp;
 }
 
This page took 0.025081 seconds and 4 git commands to generate.