]> granicus.if.org Git - graphviz/commitdiff
smyrna: remove an unnecessary 'strdup'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 9 Jul 2022 15:05:04 +0000 (08:05 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 16 Jul 2022 00:06:34 +0000 (17:06 -0700)
Pointers `getopt` returns in `optarg` point into the original `argv` which lives
in immortal storage. There is no need to duplicate such a pointer to prolong its
lifetime.

cmd/smyrna/main.c

index e1c3b0775661b522c1201634998eecc6f1ba092b..55a2e2318913dddc22de7e1035584a41dd38760f 100644 (file)
@@ -102,7 +102,7 @@ static char *parseArgs(int argc, char *argv[], ViewInfo * view)
            break;
        case 'f':
            view->guiMode=GUI_FULLSCREEN;
-           view->optArg=strdup(optarg);
+           view->optArg=optarg;
            break;
 
        case 'V':