mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 02:38:09 +09:00
torture: Fix a resource leak on error.
This commit is contained in:
@@ -110,6 +110,7 @@ int torture_rmdirs(const char *path) {
|
|||||||
len = strlen(path) + strlen(dp->d_name) + 2;
|
len = strlen(path) + strlen(dp->d_name) + 2;
|
||||||
fname = malloc(len);
|
fname = malloc(len);
|
||||||
if (fname == NULL) {
|
if (fname == NULL) {
|
||||||
|
closedir(d);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
snprintf(fname, len, "%s/%s", path, dp->d_name);
|
snprintf(fname, len, "%s/%s", path, dp->d_name);
|
||||||
|
|||||||
Reference in New Issue
Block a user