aboutsummaryrefslogtreecommitdiff
path: root/compat/qsort.c
diff options
context:
space:
mode:
authorBrandon Casey <drafnel@gmail.com>2011-10-06 13:22:22 -0500
committerJunio C Hamano <gitster@pobox.com>2011-10-06 13:54:32 -0700
commit040a655116c9755bbf30acd22c34eecb2f502c6d (patch)
tree6e1260d25fa2de20f150159de83cae2251c70824 /compat/qsort.c
parent97410b27e91593c4096bb16abbace783895a1f62 (diff)
downloadgit-040a655116c9755bbf30acd22c34eecb2f502c6d.tar.gz
git-040a655116c9755bbf30acd22c34eecb2f502c6d.tar.xz
cleanup: use internal memory allocation wrapper functions everywhere
The "x"-prefixed versions of strdup, malloc, etc. will check whether the allocation was successful and terminate the process otherwise. A few uses of malloc were left alone since they already implemented a graceful path of failure or were in a quasi external library like xdiff. Additionally, the call to malloc in compat/win32/syslog.c was not modified since the syslog() implemented there is a die handler and a call to the x-wrappers within a die handler could result in recursion should memory allocation fail. This will have to be addressed separately. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/qsort.c')
-rw-r--r--compat/qsort.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/qsort.c b/compat/qsort.c
index d93dce2cf..9574d537b 100644
--- a/compat/qsort.c
+++ b/compat/qsort.c
@@ -55,7 +55,7 @@ void git_qsort(void *b, size_t n, size_t s,
msort_with_tmp(b, n, s, cmp, buf);
} else {
/* It's somewhat large, so malloc it. */
- char *tmp = malloc(size);
+ char *tmp = xmalloc(size);
msort_with_tmp(b, n, s, cmp, tmp);
free(tmp);
}