aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Kourt <tim.a.kourt@linux.intel.com>2020-04-08 18:44:15 -0700
committerDenis Kenzior <denkenz@gmail.com>2020-04-08 16:18:04 -0500
commitf92ce9441efb1f8fd13d8aba57ba81421e824b0c (patch)
tree41ec4e927968ccff7ce02fe6c2b1041afeb0e892
parent2acda158ef4ace7958c0f8ccb68bf9f331f5974f (diff)
downloadiwd-f92ce9441efb1f8fd13d8aba57ba81421e824b0c.tar.gz
storage: Refactor dirs creation logic to cleanup on failure
-rw-r--r--src/storage.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/storage.c b/src/storage.c
index a075d31d5..00d93933f 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -200,16 +200,24 @@ bool storage_create_dirs(void)
}
storage_path = l_strdup(state_dirs[0]);
- storage_hotspot_path = l_strdup_printf("%s/hotspot/", state_dirs[0]);
l_strv_free(state_dirs);
if (create_dirs(storage_path)) {
l_error("Failed to create %s", storage_path);
+
+ l_free(storage_path);
+
return false;
}
+ storage_hotspot_path = l_strdup_printf("%s/hotspot/", storage_path);
+
if (create_dirs(storage_hotspot_path)) {
l_error("Failed to create %s", storage_hotspot_path);
+
+ l_free(storage_path);
+ l_free(storage_hotspot_path);
+
return false;
}