Commit 15760c598d57233820a68d2721643c637207a18e

Ben Straub 2013-02-01T19:21:55

Use malloc rather than calloc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/util.h b/src/util.h
index e9edd84..351ff42 100644
--- a/src/util.h
+++ b/src/util.h
@@ -64,8 +64,9 @@ GIT_INLINE(char *) git__strndup(const char *str, size_t n)
 /* NOTE: This doesn't do null or '\0' checking.  Watch those boundaries! */
 GIT_INLINE(char *) git__substrdup(const char *start, size_t n)
 {
-	char *ptr = (char*)git__calloc(n+1, sizeof(char));
+	char *ptr = (char*)git__malloc(n+1);
 	memcpy(ptr, start, n);
+	ptr[n] = '\0';
 	return ptr;
 }