aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/directory_save.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/directory_save.c b/src/directory_save.c
index 9d6933d63..d301d168b 100644
--- a/src/directory_save.c
+++ b/src/directory_save.c
@@ -128,8 +128,10 @@ directory_load_subdir(FILE *fp, struct directory *parent, const char *name,
directory = directory_new(name, parent);
success = directory_load(fp, directory, error_r);
- if (!success)
+ if (!success) {
+ directory_free(directory);
return NULL;
+ }
return directory;
}