diff --git a/testing/testing_zgepdf_qdwh.c b/testing/testing_zgepdf_qdwh.c
index 17cb18a4ac953d90b61fe565c52f0f652a2be4f3..d573d723ea25bbd5bb3a62611150ab4e935f0a73 100644
--- a/testing/testing_zgepdf_qdwh.c
+++ b/testing/testing_zgepdf_qdwh.c
@@ -86,9 +86,9 @@ testing_zgepdf_qdwh_desc( run_arg_list_t *args, int check )
     if ( hres != 0 ) {
         return hres;
     }
-    /* 
-     * descA0 is defined here because of the cost of zlatms. To copy descA in descA0 
-     * now prevents to call it again later in the check (indeed descA is modified 
+    /*
+     * descA0 is defined here because of the cost of zlatms. To copy descA in descA0
+     * now prevents to call it again later in the check (indeed descA is modified
      * with the call to CHAMELEON_zgepdf_qdwh_Tile[_Async]).
      */
     if ( check ) {
@@ -167,12 +167,14 @@ testing_zgepdf_qdwh_std( run_arg_list_t *args, int check )
     /* Fills the matrix with random values */
     hres = CHAMELEON_zlatms( M, N, ChamDistUniform, seedA, ChamNonsymPosv, NULL, mode, cond, 1., A, LDA );
     if ( hres != 0 ) {
+        free( A );
+        free( H );
         return hres;
     }
-    /* 
-     * A0 is defined here because of the cost of zlatms. To copy A in A0 
-     * now prevents to call it again later in the check (indeed A is modified 
-     * with the call to CHAMELEON_zgepdf_qdwh). 
+    /*
+     * A0 is defined here because of the cost of zlatms. To copy A in A0
+     * now prevents to call it again later in the check (indeed A is modified
+     * with the call to CHAMELEON_zgepdf_qdwh).
      */
     if ( check ) {
         A0 = malloc( LDA*N*sizeof(CHAMELEON_Complex64_t) );