Skip to content

Commit 7602620

Browse files
author
Junio C Hamano
committed
Merge branch 'maint-1.5.1' into maint
* maint-1.5.1: fix memory leak in parse_object when check_sha1_signature fails name-rev: tolerate clock skew in committer dates
2 parents a21f0f0 + 0b1f113 commit 7602620

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

builtin-name-rev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include "tag.h"
55
#include "refs.h"
66

7+
#define CUTOFF_DATE_SLOP 86400 /* one day */
8+
79
static const char name_rev_usage[] =
810
"git-name-rev [--tags | --refs=<pattern>] ( --all | --stdin | committish [committish...] )\n";
911

@@ -208,6 +210,8 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
208210
add_object_array((struct object *)commit, *argv, &revs);
209211
}
210212

213+
if (cutoff)
214+
cutoff = cutoff - CUTOFF_DATE_SLOP;
211215
for_each_ref(name_ref, &data);
212216

213217
if (transform_stdin) {

object.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ struct object *parse_object(const unsigned char *sha1)
176176
if (buffer) {
177177
struct object *obj;
178178
if (check_sha1_signature(sha1, buffer, size, typename(type)) < 0) {
179+
free(buffer);
179180
error("sha1 mismatch %s\n", sha1_to_hex(sha1));
180181
return NULL;
181182
}

0 commit comments

Comments
 (0)