From a1f69452a22689ca2eede7669e79a3e7ab849cdd Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 8 Aug 2013 12:36:11 -0500 Subject: [PATCH] git_strndup fix when OOM --- src/util.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util.h b/src/util.h index ed9624770..a784390c1 100644 --- a/src/util.h +++ b/src/util.h @@ -55,6 +55,9 @@ GIT_INLINE(char *) git__strndup(const char *str, size_t n) ptr = (char*)git__malloc(length + 1); + if (!ptr) + return NULL; + if (length) memcpy(ptr, str, length);