diff options
author | Jeremy Katz <katzj@redhat.com> | 2003-12-17 00:48:11 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2003-12-17 00:48:11 +0000 |
commit | 6365e01087497bf5ce88c02d98e8b967514b4fed (patch) | |
tree | 790e945f073ef2dc7e5b92aa1c3ee7deb17ebbad /loader2/method.c | |
parent | 186ce8ca72c6609538ddb39558ec868420416bd1 (diff) | |
download | anaconda-6365e01087497bf5ce88c02d98e8b967514b4fed.tar.gz anaconda-6365e01087497bf5ce88c02d98e8b967514b4fed.tar.xz anaconda-6365e01087497bf5ce88c02d98e8b967514b4fed.zip |
apply mikem's patch to avoid freeing things more than once (#106956)
Diffstat (limited to 'loader2/method.c')
-rw-r--r-- | loader2/method.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/loader2/method.c b/loader2/method.c index faa85ae89..98ca215c3 100644 --- a/loader2/method.c +++ b/loader2/method.c @@ -666,19 +666,20 @@ int getFileFromBlockDevice(char *device, char *path, char * dest) { } void setMethodFromCmdline(char * arg, struct loaderData_s * ld) { - char * c; + char * c, * dup; ld->method = strdup(arg); - c = ld->method; + dup = strdup(arg); + c = dup; /* : will let us delimit real information on the method */ if ((c = strtok(c, ":"))) { c = strtok(NULL, ":"); if (!strcmp(ld->method, "nfs")) { ld->methodData = calloc(sizeof(struct nfsInstallData *), 1); - ((struct nfsInstallData *)ld->methodData)->host = c; + ((struct nfsInstallData *)ld->methodData)->host = strdup(c); if ((c = strtok(NULL, ":"))) { - ((struct nfsInstallData *)ld->methodData)->directory = c; + ((struct nfsInstallData *)ld->methodData)->directory = strdup(c); } } else if (!strcmp(ld->method, "ftp") || !strcmp(ld->method, "http")) { @@ -689,12 +690,13 @@ void setMethodFromCmdline(char * arg, struct loaderData_s * ld) { } else if (!strcmp(ld->method, "harddrive") || !strcmp(ld->method, "hd")) { ld->methodData = calloc(sizeof(struct hdInstallData *), 1); - ((struct hdInstallData *)ld->methodData)->partition = c; + ((struct hdInstallData *)ld->methodData)->partition = strdup(c); if ((c = strtok(NULL, ":"))) { - ((struct hdInstallData *)ld->methodData)->directory = c; + ((struct hdInstallData *)ld->methodData)->directory = strdup(c); } } } + free(dup); } |