summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorIlari Liusvaara <ilari.liusvaara@elisanet.fi>2010-01-26 20:24:12 +0200
committerJunio C Hamano <gitster@pobox.com>2010-01-26 12:57:53 -0800
commit5bf9219d01b16444b316fe764b58d15bd9265f74 (patch)
treea218ec5aa622712e03dace7acce8aaf711a61636 /git-compat-util.h
parent35eabd1579726d594e84fc8328a5c87693dd065a (diff)
downloadgit-5bf9219d01b16444b316fe764b58d15bd9265f74.tar.gz
Add xmallocz()
Add routine for allocating NUL-terminated memory block without risking integer overflow in addition of +1 for NUL byte. [jc: with suggestion from Bill Lear] Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index ef60803384..31e2ef9e9e 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -343,6 +343,7 @@ extern void release_pack_memory(size_t, int);
extern char *xstrdup(const char *str);
extern void *xmalloc(size_t size);
+extern void *xmallocz(size_t size);
extern void *xmemdupz(const void *data, size_t len);
extern char *xstrndup(const char *str, size_t len);
extern void *xrealloc(void *ptr, size_t size);