From: Igor Murzov <igor@gplsoft.org>
To: Git Mailing List <git@vger.kernel.org>
Cc: Igor Murzov <igor@gplsoft.org>
Subject: [PATCH] fix some resource leaks discovered by cppcheck
Date: Fri, 2 Apr 2010 00:01:09 +0400 [thread overview]
Message-ID: <1270152069-28816-1-git-send-email-igor@gplsoft.org> (raw)
---
builtin/fmt-merge-msg.c | 2 ++
builtin/rerere.c | 1 +
transport.c | 1 +
3 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 9d52400..7c9ee96 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -373,6 +373,8 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
if (strbuf_read(&input, fileno(in), 0) < 0)
die_errno("could not read input file");
+ if(in != stdin)
+ fclose(in);
ret = fmt_merge_msg(merge_summary, &input, &output);
if (ret)
return ret;
diff --git a/builtin/rerere.c b/builtin/rerere.c
index 34f9ace..de76d48 100644
--- a/builtin/rerere.c
+++ b/builtin/rerere.c
@@ -64,6 +64,7 @@ static void garbage_collect(struct string_list *rr)
for (i = 0; i < to_remove.nr; i++)
unlink_rr_item(to_remove.items[i].string);
string_list_clear(&to_remove, 0);
+ closedir(dir);
}
static int outf(void *dummy, mmbuffer_t *ptr, int nbuf)
diff --git a/transport.c b/transport.c
index 8ce3936..1c61145 100644
--- a/transport.c
+++ b/transport.c
@@ -134,6 +134,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
list = &(*list)->next;
}
}
+ fclose(f);
}
static void set_upstreams(struct transport *transport, struct ref *refs,
--
1.7.0.3.313.g87b3c.dirty
reply other threads:[~2010-04-01 20:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1270152069-28816-1-git-send-email-igor@gplsoft.org \
--to=igor@gplsoft.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).