Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 4a173e1ec -> 892a413f8


DISPATCH-739: Fix memory leaks in unit tests, missing frees

Add missing frees in tests.


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/57380790
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/57380790
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/57380790

Branch: refs/heads/master
Commit: 5738079016236efb02554c6cd4536c4d8295f59a
Parents: 4a173e1
Author: Alan Conway <[email protected]>
Authored: Tue Jan 2 10:37:58 2018 -0500
Committer: Alan Conway <[email protected]>
Committed: Tue Jan 2 11:18:20 2018 -0500

----------------------------------------------------------------------
 tests/compose_test.c       | 6 +++---
 tests/proton_utils_tests.c | 4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/57380790/tests/compose_test.c
----------------------------------------------------------------------
diff --git a/tests/compose_test.c b/tests/compose_test.c
index 8e3fdd6..49f06b5 100644
--- a/tests/compose_test.c
+++ b/tests/compose_test.c
@@ -155,7 +155,7 @@ static char *test_compose_insert_empty_string(void *context)
         if (empty_string[idx] != right[idx])
             return "Pattern Mismatch";
     }
-
+    qd_compose_free(field);
     return 0;
 }
 
@@ -173,7 +173,7 @@ static char *test_compose_insert_empty_symbol(void *context)
         if (empty_string[idx] != right[idx])
             return "Pattern Mismatch";
     }
-
+    qd_compose_free(field);
     return 0;
 }
 
@@ -191,7 +191,7 @@ static char *test_compose_insert_empty_binary(void *context)
         if (empty_string[idx] != right[idx])
             return "Pattern Mismatch";
     }
-
+    qd_compose_free(field);
     return 0;
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/57380790/tests/proton_utils_tests.c
----------------------------------------------------------------------
diff --git a/tests/proton_utils_tests.c b/tests/proton_utils_tests.c
index 14d6b7e..4f2c9d5 100644
--- a/tests/proton_utils_tests.c
+++ b/tests/proton_utils_tests.c
@@ -69,18 +69,22 @@ static char *test_data_as_string(void *context)
         pn_data_t *data = pn_data(0);
         pn_data_decode(data, vector->encoded, vector->size);
         char *result = qdpn_data_as_string(data);
+        pn_data_free(data);
 
         if (result || vector->expected) {
             if ((result == 0 || vector->expected == 0) && result != 
vector->expected) {
                 snprintf(error, MAX_ERROR, "Expected '%s', got '%s'", 
vector->expected, result);
+                free(result);
                 return error;
             }
 
             if (strcmp(result, vector->expected)) {
                 snprintf(error, MAX_ERROR, "Expected '%s', got '%s'", 
vector->expected, result);
+                free(result);
                 return error;
             }
         }
+        free(result);
         vector++;
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to