From: Karol Lewandowski Date: Tue, 11 Feb 2020 15:26:08 +0000 (+0100) Subject: Do not leak fifo_path X-Git-Tag: accepted/tizen/unified/20200212.125745^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F79%2F224579%2F1;p=platform%2Fcore%2Fsystem%2Fdumpsys.git Do not leak fifo_path Change-Id: Ib8ed78d09c3ab0438f6786d91c86c8ae6d1f1f2f --- diff --git a/src/dumpsys/dumpsys.c b/src/dumpsys/dumpsys.c index 7d4a746..93d1cd1 100644 --- a/src/dumpsys/dumpsys.c +++ b/src/dumpsys/dumpsys.c @@ -87,12 +87,12 @@ static bool make_fifo(int *write_fd, int *read_fd) uid_t ruid, euid, suid; if (getresuid(&ruid, &euid, &suid) == -1) { printf("getresuid error: %m\n"); - return false; + goto end_free; } if (seteuid(suid) == -1) { printf("setuid error: %m\n"); - return false; + goto end_free; } if (mktemp(fifo_path) == NULL) { @@ -142,11 +142,13 @@ static bool make_fifo(int *write_fd, int *read_fd) result = true; end: - free(fifo_path); if (seteuid(euid) == -1) { printf("setuid error: %m\n"); result = false; } +end_free: + free(fifo_path); + return result; }