Skip to content

Commit b17832e

Browse files
committed
Avoid the leak on zero-row fwrite
1 parent a05ed11 commit b17832e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/fwrite.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -921,15 +921,12 @@ void fwriteMain(fwriteMainArgs args)
921921
if (args.nrow == 0) {
922922
if (verbose)
923923
DTPRINT(_("No data rows present (nrow==0)\n"));
924-
if (f != -1 && CLOSE(f)) {
925-
// # nocov start
926-
free(buffPool);
924+
free(buffPool);
927925
#ifndef NOZLIB
928-
free(zbuffPool);
926+
free(zbuffPool);
929927
#endif
930-
STOP(_("%s: '%s'"), strerror(errno), args.filename);
931-
// # nocov end
932-
}
928+
if (f != -1 && CLOSE(f))
929+
STOP(_("%s: '%s'"), strerror(errno), args.filename); // # nocov
933930
return;
934931
}
935932

0 commit comments

Comments
 (0)