From 4a71625eba90f2199e11915bbd39fc214396f926 Mon Sep 17 00:00:00 2001 From: Niraj Kumar Goit Date: Thu, 9 Jun 2016 22:55:39 +0530 Subject: [upstream] Fix memory leak when realloc fails. Change-Id: I9d34aa90a0ad2265339b3a05302bbe5b5f1ba211 Signed-off-by: Niraj Kumar Goit --- src/inet.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/inet.c') diff --git a/src/inet.c b/src/inet.c index bfad01cb..972fdff5 100755 --- a/src/inet.c +++ b/src/inet.c @@ -2706,7 +2706,14 @@ char **__connman_inet_get_running_interfaces(void) g_free(ifr); if (count < numif) + { + char **prev_result = result; result = g_try_realloc(result, (count + 1) * sizeof(char *)); + if (!result) { + g_free(prev_result); + goto error; + } + } return result; -- cgit v1.2.3