]> granicus.if.org Git - graphviz/commitdiff
gvpr compileProg: remove now unnecessary 'strdup'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 11 Sep 2021 18:12:51 +0000 (11:12 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 18 Sep 2021 22:14:15 +0000 (15:14 -0700)
Now that the backing memory for `endgsfx` is no longer hosted in a temporary
sfio buffer that may be overwritten, there is no need to duplicate this further.

lib/gvpr/compile.c

index 99a88c00f6b2b65851e92aac81d675fc7febf79e..e5f3fa52d5ce8fb9d1df55394686247a8f29198b 100644 (file)
@@ -2441,7 +2441,7 @@ comp_prog *compileProg(parse_prog * inp, Gpr_t * state, int flags)
 {
     comp_prog *p;
     Sfio_t *tmps = state->tmp;
-    char *endg_sfx = 0;
+    const char *endg_sfx = NULL;
     int i, useflags = 0;
 
     /* Initialize default io */
@@ -2458,7 +2458,7 @@ comp_prog *compileProg(parse_prog * inp, Gpr_t * state, int flags)
     }
 
     if (flags) {
-       endg_sfx = strdup (doFlags(flags));
+       endg_sfx = doFlags(flags);
     }
 
     if (!initDisc(state))
@@ -2522,7 +2522,6 @@ comp_prog *compileProg(parse_prog * inp, Gpr_t * state, int flags)
        freeCompileProg (p);
        p = 0;
     }
-    free (endg_sfx);
 
     return p;
 }