[Upstream]: Fix HANDLE_LEAK and memory leak issues. 04/84804/1
authorSumit Aggarwal <aggarwal.s@samsung.com>
Mon, 22 Aug 2016 11:33:44 +0000 (17:03 +0530)
committerSumit Aggarwal <aggarwal.s@samsung.com>
Mon, 22 Aug 2016 11:33:44 +0000 (17:03 +0530)
link: https://gitlab.com/gnutls/gnutls/commit/39cdaed454b12c7be9881d550ec2ea89c649c707
Signed-off-by: Sumit Aggarwal <aggarwal.s@samsung.com>
Change-Id: I35651c359c3c6ef25cc74adacd545fa1faca1c09

src/benchmark-cipher.c
src/srptool.c

index 586c386..50de388 100644 (file)
@@ -56,8 +56,11 @@ static void cipher_mac_bench(int algo, int mac_algo, int size)
        memset(_key, 0xf0, keysize);
 
        _iv = malloc(ivsize);
-       if (_iv == NULL)
+       if (_iv == NULL) {
+               if (_key)
+                       free(_key);
                return;
+       }
        memset(_iv, 0xf0, ivsize);
 
        iv.data = _iv;
index 5d60cde..8260f15 100644 (file)
@@ -114,11 +114,13 @@ static int generate_create_conf(const char *tpasswd_conf)
 
                if (gnutls_srp_base64_encode_alloc(&n, &str_n) < 0) {
                        fprintf(stderr, "Could not encode\n");
+                       fclose(fd);
                        return -1;
                }
 
                if (gnutls_srp_base64_encode_alloc(&g, &str_g) < 0) {
                        fprintf(stderr, "Could not encode\n");
+                       fclose(fd);
                        return -1;
                }