diff options
author | Slava Semushin <php-coder@altlinux.ru> | 2009-05-23 20:51:53 +0700 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2009-05-26 09:39:54 +0200 |
commit | 5a929c3488e495083bfc687f3cfd36b818136b0e (patch) | |
tree | 9e1b181c3af61ab79586d77c5117e96260730d16 | |
parent | 87f605494851eab62114d862aecefb7b4c808ce1 (diff) | |
download | samba-5a929c3488e495083bfc687f3cfd36b818136b0e.tar.gz |
source{3,4}/torture/smbiconv.c(main): fixed file descriptor leak.
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
(cherry picked from commit 61cca8aa5f5e3ad665c3b1acfab20802dd0f3f3a)
-rw-r--r-- | source3/torture/smbiconv.c | 1 | ||||
-rw-r--r-- | source4/torture/smbiconv.c | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/source3/torture/smbiconv.c b/source3/torture/smbiconv.c index 72fbdc470fe..47353d2a943 100644 --- a/source3/torture/smbiconv.c +++ b/source3/torture/smbiconv.c @@ -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; } diff --git a/source4/torture/smbiconv.c b/source4/torture/smbiconv.c index 4eece66bdf6..173f37175bf 100644 --- a/source4/torture/smbiconv.c +++ b/source4/torture/smbiconv.c @@ -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; } |