Skip to content

Commit c3958a7

Browse files
author
Junio C Hamano
committed
Merge with master.
This merges commit c882bc9 from master into our head commit e764a10 Sincerely, jit-merge command.
2 parents e764a10 + c882bc9 commit c3958a7

File tree

8 files changed

+43
-12
lines changed

8 files changed

+43
-12
lines changed

csum-file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ int sha1close(struct sha1file *f, unsigned char *result, int update)
4545
sha1flush(f, 20);
4646
if (close(f->fd))
4747
die("%s: sha1 file error on close (%s)", f->name, strerror(errno));
48+
free(f);
4849
return 0;
4950
}
5051

git-clone-dumb-http

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if [ -n "$GIT_SSL_NO_VERIFY" ]; then
1414
fi
1515
http_fetch () {
1616
# $1 = Remote, $2 = Local
17-
curl -ns $curl_extra_args "$1" >"$2"
17+
curl -nsf $curl_extra_args "$1" >"$2"
1818
}
1919

2020
cd "$D" &&

git-fetch-script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ http://* | https://*)
1515
fi
1616
_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' &&
1717
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" &&
18-
head=$(curl -ns $curl_extra_args "$merge_repo/$merge_head") &&
18+
head=$(curl -nsf $curl_extra_args "$merge_repo/$merge_head") &&
1919
expr "$head" : "$_x40\$" >/dev/null || {
2020
echo >&2 "Failed to fetch $merge_head from $merge_repo"
2121
exit 1

git-ls-remote-script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ http://* | https://* )
4646
if [ -n "$GIT_SSL_NO_VERIFY" ]; then
4747
curl_extra_args="-k"
4848
fi
49-
curl -ns $curl_extra_args "$peek_repo/info/refs" || exit 1
49+
curl -nsf $curl_extra_args "$peek_repo/info/refs" || exit 1
5050
;;
5151

5252
rsync://* )

git-tag-script

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
. git-sh-setup-script || die "Not a git archive"
55

66
usage () {
7-
echo >&2 "Usage: git-tag-script [-a | -s] [-f] tagname"
7+
echo >&2 "Usage: git-tag-script [-a | -s] [-f] [-m "tag message"] tagname"
88
exit 1
99
}
1010

1111
annotate=
1212
signed=
1313
force=
14+
message=
1415
while case "$#" in 0) break ;; esac
1516
do
1617
case "$1" in
@@ -24,6 +25,11 @@ do
2425
-f)
2526
force=1
2627
;;
28+
-m)
29+
annotate=1
30+
shift
31+
message="$1"
32+
;;
2733
-*)
2834
usage
2935
;;
@@ -48,10 +54,14 @@ tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1
4854
trap 'rm -f .tmp-tag* .tagmsg .editmsg' 0
4955

5056
if [ "$annotate" ]; then
51-
( echo "#"
52-
echo "# Write a tag message"
53-
echo "#" ) > .editmsg
54-
${VISUAL:-${EDITOR:-vi}} .editmsg || exit
57+
if [ -z "$message" ]; then
58+
( echo "#"
59+
echo "# Write a tag message"
60+
echo "#" ) > .editmsg
61+
${VISUAL:-${EDITOR:-vi}} .editmsg || exit
62+
else
63+
echo "$message" > .editmsg
64+
fi
5565

5666
grep -v '^#' < .editmsg | git-stripspace > .tagmsg
5767

pack-objects.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,10 @@ static void find_deltas(struct object_entry **list, int window, int depth)
382382
if (idx >= window)
383383
idx = 0;
384384
}
385+
386+
for (i = 0; i < window; ++i)
387+
free(array[i].data);
388+
free(array);
385389
}
386390

387391
int main(int argc, char **argv)

path.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,13 @@ int git_mkstemp(char *path, size_t len, const char *template)
6868
if ((env = getenv("TMPDIR")) == NULL) {
6969
strcpy(pch, "/tmp/");
7070
len -= 5;
71-
} else
72-
len -= snprintf(pch, len, "%s/", env);
71+
pch += 5;
72+
} else {
73+
size_t n = snprintf(pch, len, "%s/", env);
74+
75+
len -= n;
76+
pch += n;
77+
}
7378

7479
safe_strncpy(pch, template, len);
7580

sha1_file.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,7 @@ void *read_object_with_reference(const unsigned char *sha1,
11651165
free(buffer);
11661166
return NULL;
11671167
}
1168+
free(buffer);
11681169
/* Now we have the ID of the referred-to object in
11691170
* actual_sha1. Check again. */
11701171
}
@@ -1296,8 +1297,11 @@ int write_sha1_to_fd(int fd, const unsigned char *sha1)
12961297
ssize_t size;
12971298
unsigned long objsize;
12981299
int posn = 0;
1299-
void *buf = map_sha1_file_internal(sha1, &objsize);
1300+
void *map = map_sha1_file_internal(sha1, &objsize);
1301+
void *buf = map;
1302+
void *temp_obj = NULL;
13001303
z_stream stream;
1304+
13011305
if (!buf) {
13021306
unsigned char *unpacked;
13031307
unsigned long len;
@@ -1313,7 +1317,7 @@ int write_sha1_to_fd(int fd, const unsigned char *sha1)
13131317
memset(&stream, 0, sizeof(stream));
13141318
deflateInit(&stream, Z_BEST_COMPRESSION);
13151319
size = deflateBound(&stream, len + hdrlen);
1316-
buf = xmalloc(size);
1320+
temp_obj = buf = xmalloc(size);
13171321

13181322
/* Compress it */
13191323
stream.next_out = buf;
@@ -1331,6 +1335,7 @@ int write_sha1_to_fd(int fd, const unsigned char *sha1)
13311335
while (deflate(&stream, Z_FINISH) == Z_OK)
13321336
/* nothing */;
13331337
deflateEnd(&stream);
1338+
free(unpacked);
13341339

13351340
objsize = stream.total_out;
13361341
}
@@ -1347,6 +1352,12 @@ int write_sha1_to_fd(int fd, const unsigned char *sha1)
13471352
}
13481353
posn += size;
13491354
} while (posn < objsize);
1355+
1356+
if (map)
1357+
munmap(map, objsize);
1358+
if (temp_obj)
1359+
free(temp_obj);
1360+
13501361
return 0;
13511362
}
13521363

0 commit comments

Comments
 (0)