All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: iwd@lists.01.org
Subject: [PATCH 1/3] storage: Refactor dirs creation logic to cleanup on failure
Date: Wed, 08 Apr 2020 18:44:15 -0700	[thread overview]
Message-ID: <20200409014417.10029-1-tim.a.kourt@linux.intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 842 bytes --]

---
 src/storage.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/storage.c b/src/storage.c
index a075d31d..00d93933 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;
 	}
 
-- 
2.13.6

             reply	other threads:[~2020-04-09  1:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09  1:44 Tim Kourt [this message]
2020-04-09  1:44 ` [PATCH 2/3] main: Fix failure cleanup sequence Tim Kourt
2020-04-09  1:44 ` [PATCH 3/3] main: Simplify config file search logic Tim Kourt
2020-04-09 15:41 ` [PATCH 1/3] storage: Refactor dirs creation logic to cleanup on failure Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200409014417.10029-1-tim.a.kourt@linux.intel.com \
    --to=tim.a.kourt@linux.intel.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.