Use xrealloc instead of realloc

Change places that use realloc, without a proper error path, to instead use
xrealloc. Drop an erroneous error path in the daemon code that used errno
in the die message in favour of the simpler xrealloc.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Jonas Fonseca
2006-08-26 16:16:18 +02:00
committed by Junio C Hamano
parent 095c424d08
commit 83572c1a91
9 changed files with 21 additions and 26 deletions

View File

@ -101,7 +101,7 @@ static int git_format_config(const char *var, const char *value)
if (!strcmp(var, "format.headers")) {
int len = strlen(value);
extra_headers_size += len + 1;
extra_headers = realloc(extra_headers, extra_headers_size);
extra_headers = xrealloc(extra_headers, extra_headers_size);
extra_headers[extra_headers_size - len - 1] = 0;
strcat(extra_headers, value);
return 0;
@ -381,7 +381,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
continue;
nr++;
list = realloc(list, nr * sizeof(list[0]));
list = xrealloc(list, nr * sizeof(list[0]));
list[nr - 1] = commit;
}
total = nr;