mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-05 13:48:41 +00:00
git_strndup fix when OOM
This commit is contained in:
parent
57f31f058c
commit
a1f69452a2
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user