eet: handling memory leak on realloc fail.
authorSrivardhan Hebbar <sri.hebbar@samsung.com>
Wed, 21 Oct 2015 20:50:17 +0000 (13:50 -0700)
committerCedric BAIL <cedric@osg.samsung.com>
Wed, 21 Oct 2015 20:51:34 +0000 (13:51 -0700)
Summary: Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Differential Revision: https://phab.enlightenment.org/D3207

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/lib/eet/eet_cipher.c

index 6ccb9cc..9bff406 100644 (file)
@@ -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;