diff options
author | Jim Meyering <jim@meyering.net> | 2011-06-20 09:40:06 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-06-20 14:27:36 -0700 |
commit | dc4cd767108532161d27554162a8742f5b607eb8 (patch) | |
tree | 605e8af6e513dbe39435b256b3f8b164911a8d6d /builtin | |
parent | 28eb1afec90fab398fc58a1d6119b9e99a733f87 (diff) | |
download | git-dc4cd767108532161d27554162a8742f5b607eb8.tar.gz |
plug a few coverity-spotted leaks
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/cat-file.c | 2 | ||||
-rw-r--r-- | builtin/diff.c | 1 | ||||
-rw-r--r-- | builtin/update-index.c | 4 |
3 files changed, 6 insertions, 1 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 94632dbdb4..07bd984084 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -187,6 +187,8 @@ static int batch_one_object(const char *obj_name, int print_contents) if (type <= 0) { printf("%s missing\n", obj_name); fflush(stdout); + if (print_contents == BATCH) + free(contents); return 0; } diff --git a/builtin/diff.c b/builtin/diff.c index 14bd14fce0..69cd5eed78 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -182,6 +182,7 @@ static int builtin_diff_combined(struct rev_info *revs, hashcpy((unsigned char *)(parent + i), ent[i].item->sha1); diff_tree_combined(parent[0], parent + 1, ents - 1, revs->dense_combined_merges, revs); + free(parent); return 0; } diff --git a/builtin/update-index.c b/builtin/update-index.c index f14bc90830..a6a23fa1f3 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -100,8 +100,10 @@ static int add_one_path(struct cache_entry *old, const char *path, int len, stru ce->ce_mode = ce_mode_from_stat(old, st->st_mode); if (index_path(ce->sha1, path, st, - info_only ? 0 : HASH_WRITE_OBJECT)) + info_only ? 0 : HASH_WRITE_OBJECT)) { + free(ce); return -1; + } option = allow_add ? ADD_CACHE_OK_TO_ADD : 0; option |= allow_replace ? ADD_CACHE_OK_TO_REPLACE : 0; if (add_cache_entry(ce, option)) |