diff options
author | Edward Thomson <ethomson@microsoft.com> | 2013-08-08 12:36:11 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2013-08-08 12:36:11 -0500 |
commit | a1f69452a22689ca2eede7669e79a3e7ab849cdd (patch) | |
tree | e3ba1d3b1ca69868d86c0d61ff5b02b4e0cf0c29 | |
parent | 57f31f058c29edfd7d6d810fcd4a964875e9d463 (diff) | |
download | libgit2-a1f69452a22689ca2eede7669e79a3e7ab849cdd.tar.gz |
git_strndup fix when OOM
-rw-r--r-- | src/util.h | 3 |
1 files changed, 3 insertions, 0 deletions
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); |