mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-25 03:35:49 +01:00
WUtil: fix improper use of de-allocated variable (Coverity #109618)
As pointed by Coverity, the variable 'path_dst' was first free'd, then it was used in the 'unlink' function. This patch fixes the call order to de-allocate the string only when it is no more needed. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
032f6587d9
commit
6ef343ed87
@@ -513,9 +513,9 @@ int wcopy_file(const char *dest_dir, const char *src_file, const char *dest_file
|
|||||||
werror(_("could not close the file \"%s\": %s"), path_dst, strerror(errno));
|
werror(_("could not close the file \"%s\": %s"), path_dst, strerror(errno));
|
||||||
cleanup_and_return_failure:
|
cleanup_and_return_failure:
|
||||||
free(buffer);
|
free(buffer);
|
||||||
wfree(path_dst);
|
|
||||||
close(fd_src);
|
close(fd_src);
|
||||||
unlink(path_dst);
|
unlink(path_dst);
|
||||||
|
wfree(path_dst);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user