]> git.zerfleddert.de Git - rsbs2/commitdiff
firmware: fix firmware extraction
authorMichael Gernoth <michael@gernoth.net>
Fri, 9 Feb 2018 10:10:31 +0000 (11:10 +0100)
committerMichael Gernoth <michael@gernoth.net>
Fri, 9 Feb 2018 10:10:31 +0000 (11:10 +0100)
src/filesystem.c

index da3cf76b30ff8a7cdf45345443a62b072e9472b7..f0465a8c621d98ea11bc90ed8d4b47784cff1bfa 100644 (file)
@@ -163,11 +163,19 @@ void list_files(uint8_t *fw, int32_t len)
 void mkdir_p(char *dir)
 {
        char *parent;
+       char *tmpdir;
 
        if ((dir == NULL) || (!strcmp(dir, ".")))
                return;
 
-       parent = strdup(dirname(dir));
+       tmpdir = strdup(dir);
+       if (tmpdir == NULL) {
+               perror("strdup");
+               exit(1);
+       }
+
+       parent = strdup(dirname(tmpdir));
+       free(tmpdir);
        if (parent == NULL) {
                perror("strdup");
                exit(1);
Impressum, Datenschutz