summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 28eb1af)
raw | patch | inline | side by side (parent: 28eb1af)
author | Jim Meyering <jim@meyering.net> | |
Mon, 20 Jun 2011 07:40:06 +0000 (09:40 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 20 Jun 2011 21:27:36 +0000 (14:27 -0700) |
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/cat-file.c | patch | blob | history | |
builtin/diff.c | patch | blob | history | |
builtin/update-index.c | patch | blob | history | |
remote-curl.c | patch | blob | history |
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 94632dbdb400f9a2986d10f06dd16119ce1b4e54..07bd984084fbbfbb826ef5b784fc68069675e73c 100644 (file)
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
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 14bd14fce0fa6b9c9b047142d23d4a2237b57a36..69cd5eed78cb402839813e7eca65b5598afa4a90 100644 (file)
--- a/builtin/diff.c
+++ b/builtin/diff.c
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 f14bc908309c0bb01ec251d71f26b490b294622c..a6a23fa1f3c7782566d7fcfe470dd424b876e4a5 100644 (file)
--- 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))
diff --git a/remote-curl.c b/remote-curl.c
index 17d8a9b377265aeed9765f04d505959e1f7fb9b0..b5be25ce9623936e42566ca52b9e4d1d33153111 100644 (file)
--- a/remote-curl.c
+++ b/remote-curl.c
strbuf_reset(buf);
if (strbuf_getline(buf, stdin, '\n') == EOF)
- return;
+ goto free_specs;
if (!*buf->buf)
break;
} while (1);
if (push(nr_spec, specs))
exit(128); /* error already reported */
- for (i = 0; i < nr_spec; i++)
- free(specs[i]);
- free(specs);
printf("\n");
fflush(stdout);
+
+ free_specs:
+ for (i = 0; i < nr_spec; i++)
+ free(specs[i]);
+ free(specs);
}
int main(int argc, const char **argv)