mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
lib: Fix CID 1034836 Resource leak
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
This commit is contained in:
parent
607301a843
commit
19b28ee828
@ -69,19 +69,23 @@ static int test_ftruncate(void)
|
||||
}
|
||||
if (ftruncate(fd, size) != 0) {
|
||||
printf("failure: ftruncate [\n%s\n]\n", strerror(errno));
|
||||
close(fd);
|
||||
return false;
|
||||
}
|
||||
if (fstat(fd, &st) != 0) {
|
||||
printf("failure: ftruncate [\nfstat failed - %s\n]\n", strerror(errno));
|
||||
close(fd);
|
||||
return false;
|
||||
}
|
||||
if (st.st_size != size) {
|
||||
printf("failure: ftruncate [\ngave wrong size %d - expected %d\n]\n",
|
||||
(int)st.st_size, size);
|
||||
close(fd);
|
||||
return false;
|
||||
}
|
||||
unlink(TESTFILE);
|
||||
printf("success: ftruncate\n");
|
||||
close(fd);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user