diff options
author | Patrick Steinhardt <ps@pks.im> | 2016-02-23 09:54:26 +0100 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2016-02-23 11:50:23 +0100 |
commit | 859ed5ddc7dc0e208215079265fb012eb8b48048 (patch) | |
tree | 888abd131256978bf558cd79884db6fdcbf646d8 /script | |
parent | f2a554b45e52d7e682f26796e492cd64d8b9a6f4 (diff) | |
download | libgit2-859ed5ddc7dc0e208215079265fb012eb8b48048.tar.gz |
common: introduce GITERR_CHECK_ALLOC_BUF
We commonly have to check if a git_buf has been allocated
correctly or if we ran out of memory. Introduce a new macro
similar to `GITERR_CHECK_ALLOC` which checks if we ran OOM and if
so returns an error. Provide a `#nodef` for Coverity to mark the
error case as an abort path.
Diffstat (limited to 'script')
-rw-r--r-- | script/user_nodefs.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/script/user_nodefs.h b/script/user_nodefs.h index 5b0be81a3..3c06a706d 100644 --- a/script/user_nodefs.h +++ b/script/user_nodefs.h @@ -6,6 +6,7 @@ */ #nodef GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { __coverity_panic__(); } +#nodef GITERR_CHECK_ALLOC_BUF(buf) if (buf == NULL || git_buf_oom(buf)) { __coverity_panic__(); } #nodef GITERR_CHECK_ALLOC_ADD(out, one, two) \ if (GIT_ADD_SIZET_OVERFLOW(out, one, two)) { __coverity_panic__(); } |