From a9dd2a16b8b5677b0ad4ea19fb2689fbb5ef88a4 Mon Sep 17 00:00:00 2001 From: Imran Zaman Date: Tue, 8 Sep 2015 13:19:35 +0300 Subject: [PATCH] tizen-platform-wrapper: fix resource leak 'sum' is free'd when it is not in use anymore Signed-off-by: Imran Zaman Change-Id: I3add11bc32bc496bd0b1069310a60245cdac77d0 --- src/toolbox.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/toolbox.c b/src/toolbox.c index 0c48f36..35dfd3d 100644 --- a/src/toolbox.c +++ b/src/toolbox.c @@ -703,14 +703,19 @@ static int signup( FILE *output) term = ';'; for (key = keys ; key != NULL ; key = key->next) { status = sha256sum_add_data(sum, key->name, strlen(key->name)); - if (status < 0) + if (status < 0) { + sha256sum_destroy(sum); return status; + } status = sha256sum_add_data(sum, &term, 1); - if (status < 0) + if (status < 0) { + sha256sum_destroy(sum); return status; + } } status = sha256sum_get(sum, signup); + sha256sum_destroy(sum); if (status < 0) return status; -- 2.7.4