From 80ccf755a67cba8cad62efd6f3a5de3654adb6cc Mon Sep 17 00:00:00 2001 From: Srivardhan Hebbar Date: Wed, 21 Oct 2015 13:50:17 -0700 Subject: [PATCH] eet: handling memory leak on realloc fail. Summary: Signed-off-by: Srivardhan Hebbar Reviewers: cedric Differential Revision: https://phab.enlightenment.org/D3207 Signed-off-by: Cedric BAIL --- src/lib/eet/eet_cipher.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/eet/eet_cipher.c b/src/lib/eet/eet_cipher.c index 6ccb9cc..9bff406 100644 --- a/src/lib/eet/eet_cipher.c +++ b/src/lib/eet/eet_cipher.c @@ -314,9 +314,12 @@ eet_identity_print(Eet_Key *key, while ((err = gnutls_hex_encode(rsa_raw + i, res, &size)) == GNUTLS_E_SHORT_MEMORY_BUFFER) { + char *temp; + size += 128; - if (!(res = realloc(res, size))) + if (!(temp = realloc(res, size))) goto on_error; + res = temp; } if (err) goto on_error; -- 2.7.4