[PATCH] osmo-mgw[master]: mgcp_test: sanitize: free msgb_ctx

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Sat Nov 18 20:30:57 UTC 2017


Review at  https://gerrit.osmocom.org/4920

mgcp_test: sanitize: free msgb_ctx

Ensure that all msgb were cleaned up, then free the overall msgb_ctx, in order
to not leave any memory leaks the sanitizer build complains about.

Change-Id: I53373023a6c3f490d6d6cb1c283db5dfb915882c
---
M tests/mgcp/mgcp_test.c
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/20/4920/1

diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index 8cdfb91..3c89074 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -1330,7 +1330,7 @@
 
 int main(int argc, char **argv)
 {
-	msgb_talloc_ctx_init(NULL, 0);
+	void *msgb_ctx = msgb_talloc_ctx_init(NULL, 0);
 	osmo_init_logging(&log_info);
 
 	test_strline();
@@ -1349,6 +1349,9 @@
 	test_no_name();
 	test_osmux_cid();
 
+	OSMO_ASSERT(talloc_total_size(msgb_ctx) == 0);
+	OSMO_ASSERT(talloc_total_blocks(msgb_ctx) == 1);
+	talloc_free(msgb_ctx);
 	printf("Done\n");
 	return EXIT_SUCCESS;
 }

-- 
To view, visit https://gerrit.osmocom.org/4920
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53373023a6c3f490d6d6cb1c283db5dfb915882c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list