From e5ba667ceaac3c6da6882218ee22769ff35facee Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 29 Sep 2013 21:06:29 +0200 Subject: [PATCH] test_writesame16_unmap: Do not leak memory if WRITESAME16 is not supported Detected by Valgrind. Signed-off-by: Bart Van Assche --- test-tool/test_writesame16_unmap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test-tool/test_writesame16_unmap.c b/test-tool/test_writesame16_unmap.c index 6a69423..3e3dfd9 100644 --- a/test-tool/test_writesame16_unmap.c +++ b/test-tool/test_writesame16_unmap.c @@ -54,7 +54,7 @@ test_writesame16_unmap(void) if (ret == -2) { logging(LOG_NORMAL, "[SKIPPED] WRITESAME16 is not implemented."); CU_PASS("[SKIPPED] Target does not support WRITESAME16. Skipping test"); - return; + goto finished; } CU_ASSERT_EQUAL(ret, 0); @@ -142,7 +142,7 @@ test_writesame16_unmap(void) "BlockLimits VPD is missing."); CU_FAIL("[FAILED] WRITESAME16 works but " "BlockLimits VPD is missing."); - return; + goto finished; } i = 256; @@ -247,5 +247,7 @@ test_writesame16_unmap(void) 0, 1, 0, 0, buf); CU_ASSERT_EQUAL(ret, 0); } + +finished: free(buf); }