summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiraj Kumar Goit <niraj.g@samsung.com>2016-06-09 17:25:39 (GMT)
committerNiraj Kumar Goit <niraj.g@samsung.com>2016-06-10 08:13:24 (GMT)
commit4a71625eba90f2199e11915bbd39fc214396f926 (patch)
tree5eb1cc735924ad51e5e663998b7d673b9f961093
parent236c2b4391771af3eef2e4c2ec65375aab0e6137 (diff)
downloadconnman-4a71625eba90f2199e11915bbd39fc214396f926.zip
connman-4a71625eba90f2199e11915bbd39fc214396f926.tar.gz
connman-4a71625eba90f2199e11915bbd39fc214396f926.tar.bz2
[upstream] Fix memory leak when realloc fails.refs/changes/07/73807/2
Change-Id: I9d34aa90a0ad2265339b3a05302bbe5b5f1ba211 Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
-rwxr-xr-xsrc/inet.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/inet.c b/src/inet.c
index bfad01c..972fdff 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;