From 5647c0b738e09d1184a742790933d4e5df1dfc01 Mon Sep 17 00:00:00 2001 From: Mike McTernan Date: Mon, 18 Dec 2023 11:03:36 +0000 Subject: [PATCH] trusty: storageproxyd: fix logging of freed path pointer Bug: 316859216 Test: build.py Change-Id: I09557d43cda13e21175ba6fceeb806ec1f9115e1 --- trusty/storage/proxy/storage.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trusty/storage/proxy/storage.c b/trusty/storage/proxy/storage.c index 229948119..8c8edb779 100644 --- a/trusty/storage/proxy/storage.c +++ b/trusty/storage/proxy/storage.c @@ -353,7 +353,6 @@ int storage_file_open(struct storage_msg* msg, const void* r, size_t req_len, if (open_flags & O_CREAT) { sync_parent(path, watcher); } - free(path); /* at this point rc contains storage file fd */ msg->result = STORAGE_NO_ERROR; @@ -361,6 +360,9 @@ int storage_file_open(struct storage_msg* msg, const void* r, size_t req_len, ALOGV("%s: \"%s\": fd = %u: handle = %d\n", __func__, path, rc, resp.handle); + free(path); + path = NULL; + /* a backing file has been opened, notify any waiting init steps */ if (!fs_ready_initialized) { rc = property_set(FS_READY_PROPERTY, "1");