[PATCH libksba 7/7] Fix two memory leaks in cert-basic test

Dmitry Eremin-Solenikov dbaryshkov at gmail.com
Sat Jul 12 13:11:19 CEST 2014


* tests/cert-basic.c (one_file): always free public key and der2.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
---
 tests/cert-basic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/cert-basic.c b/tests/cert-basic.c
index 1a89cd9..91b394e 100644
--- a/tests/cert-basic.c
+++ b/tests/cert-basic.c
@@ -520,11 +520,15 @@ one_file (const char *fname)
                              __FILE__, __LINE__);
                     errorcount++;
                     xfree (der2);
+                  } else {
+                    /* Don't leak memory if everything is ok. */
+                    xfree (der2);
                   }
                 xfree (tmp);
               }
             xfree (der);
           }
+        ksba_free (public);
       }
   }
 #endif
-- 
2.0.0




More information about the Gnupg-devel mailing list