summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2015-03-31 09:34:54 +0200
committerMichael Adam <obnox@samba.org>2015-04-21 19:37:16 +0200
commit0f91e4e18db5f896c94f98e84f572568d0b1c3e4 (patch)
tree85e5acf36b3a721ad954ff309706f39a05fdc07f /lib
parentb8ac9853b0483fc4af82f731337464f9b5aaf53c (diff)
downloadsamba-0f91e4e18db5f896c94f98e84f572568d0b1c3e4.tar.gz
lib: Fix a few CIDs for Resource Leak
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/util/tests/file.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/util/tests/file.c b/lib/util/tests/file.c
index 85080818de0..f349c214f08 100644
--- a/lib/util/tests/file.c
+++ b/lib/util/tests/file.c
@@ -66,6 +66,7 @@ static bool test_afdgets(struct torture_context *tctx)
int fd;
char *line;
TALLOC_CTX *mem_ctx = tctx;
+ bool ret = false;
torture_assert(tctx, file_save(TEST_FILENAME, (const void *)TEST_DATA,
strlen(TEST_DATA)),
@@ -76,18 +77,22 @@ static bool test_afdgets(struct torture_context *tctx)
torture_assert(tctx, fd != -1, "opening file");
line = afdgets(fd, mem_ctx, 8);
- torture_assert(tctx, strcmp(line, TEST_LINE1) == 0, "line 1 mismatch");
+ torture_assert_goto(tctx, strcmp(line, TEST_LINE1) == 0, ret, done,
+ "line 1 mismatch");
line = afdgets(fd, mem_ctx, 8);
- torture_assert(tctx, strcmp(line, TEST_LINE2) == 0, "line 2 mismatch");
+ torture_assert_goto(tctx, strcmp(line, TEST_LINE2) == 0, ret, done,
+ "line 2 mismatch");
line = afdgets(fd, mem_ctx, 8);
- torture_assert(tctx, strcmp(line, TEST_LINE3) == 0, "line 3 mismatch");
-
+ torture_assert_goto(tctx, strcmp(line, TEST_LINE3) == 0, ret, done,
+ "line 3 mismatch");
+ ret = true;
+done:
close(fd);
unlink(TEST_FILENAME);
- return true;
+ return ret;
}
struct torture_suite *torture_local_util_file(TALLOC_CTX *mem_ctx)