summaryrefslogtreecommitdiff
blob: 470defd33cf675ac5209724f68eccf6b2854841b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--- a/gptcl.cc
+++ b/gptcl.cc
@@ -156,9 +156,10 @@
 
    // Assume first non-option argument is the device filename....
    device = (char*) poptGetArg(poptCon);
-   poptResetContext(poptCon);
 
    if (device != NULL) {
+      device = strdup(device);
+      poptResetContext(poptCon);
       JustLooking(); // reset as necessary
       BeQuiet(); // Tell called functions to be less verbose & interactive
       if (LoadPartitions((string) device)) {
@@ -498,6 +499,7 @@
          cerr << "Error encountered; not saving changes.\n";
          retval = 4;
       } // if
+      free(device);
    } // if (device != NULL)
    poptFreeContext(poptCon);
    return retval;