Skip to content

Commit

Permalink
source{3,4}/torture/smbiconv.c(main): fixed file descriptor leak.
Browse files Browse the repository at this point in the history
File descriptor leaks only when we use file instead of stdout.

Found by cppcheck:
[./source3/torture/smbiconv.c:219]: (error) Resource leak: out
[./source4/torture/smbiconv.c:211]: (error) Resource leak: out
  • Loading branch information
php-coder authored and vlendec committed May 25, 2009
1 parent 95dbd7d commit 5d2cd81
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions source3/torture/smbiconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ int main(int argc, char *argv[])
cd = smb_iconv_open(to, from);
if (cd == (smb_iconv_t)-1) {
DEBUG(0,("unable to find from or to encoding, exiting...\n"));
if (out != stdout) fclose(out);
return 1;
}

Expand Down
1 change: 1 addition & 0 deletions source4/torture/smbiconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ int main(int argc, char *argv[])
cd = smb_iconv_open_ex(tctx, to, from, lp_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
if((int)cd == -1) {
DEBUG(0,("unable to find from or to encoding, exiting...\n"));
if (out != stdout) fclose(out);
return 1;
}

Expand Down

0 comments on commit 5d2cd81

Please sign in to comment.