* [PATCH] fix some resource leaks discovered by cppcheck
@ 2010-04-01 20:01 Igor Murzov
0 siblings, 0 replies; only message in thread
From: Igor Murzov @ 2010-04-01 20:01 UTC (permalink / raw)
To: Git Mailing List; +Cc: Igor Murzov
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-04-01 20:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-01 20:01 [PATCH] fix some resource leaks discovered by cppcheck Igor Murzov
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).