diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2016-03-23 16:51:52 +0100 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2016-10-01 17:41:29 +0200 |
commit | adfece0df2153234970ded1b0552c5150e7f0c53 (patch) | |
tree | 54316f6d13ee041a51d3c48ecc309670cddb517a | |
parent | 5a9d850e76c0ff5bc3118f3d129e8a9b6c07c262 (diff) | |
download | libgit2-cmn/v24-updates.tar.gz |
array: fix search for empty arrayscmn/v24-updates
When the array is empty `cmp` never gets set by the comparison
function. Initialize it so we return ENOTFOUND in those cases.
-rw-r--r-- | src/array.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/array.h b/src/array.h index 490e6be20..78d321e82 100644 --- a/src/array.h +++ b/src/array.h @@ -96,7 +96,7 @@ GIT_INLINE(int) git_array__search( { size_t lim; unsigned char *part, *array = array_ptr, *base = array_ptr; - int cmp; + int cmp = -1; for (lim = array_len; lim != 0; lim >>= 1) { part = base + (lim >> 1) * item_size; |