Fix freeing errors in copy-recursive

This commit is contained in:
Such Meme, Many Skill
2020-02-22 19:05:50 +01:00
parent c2df3d80dd
commit 7f7c2e65ee

View File

@@ -240,9 +240,6 @@ int copy_recursive(char *path, char *dstpath){
}
f_closedir(&dir);
free(startpath);
free(destpath);
free(destfoldername);
if (f_stat(startpath, &fno))
return 22;
@@ -250,6 +247,9 @@ int copy_recursive(char *path, char *dstpath){
if ((res = f_chmod(destpath, fno.fattrib, 0x3A)))
return res;
free(startpath);
free(destpath);
free(destfoldername);
return 0;
}