From df2b0f99485e065224af89b910370c394d0ef8d0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 23 Sep 2012 22:10:40 +0200 Subject: Fix MP_TARRAY_GROW macro This macro is supposed to make sure an array has enough memory allocated for a given number of elements. Unfortunately, a condition was inverted (I... what???). It only allocated if there was still enough memory left, or only one additional element had to be allocated. Since this macro was only used by MP_TARRAY_APPEND, this case was never actually triggered. It's still utter non-sense. --- mpcommon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpcommon.h b/mpcommon.h index 472a2e1943..674d9b1554 100644 --- a/mpcommon.h +++ b/mpcommon.h @@ -41,7 +41,7 @@ do { \ size_t nextidx_ = (nextidx); \ size_t nelems_ = MP_TALLOC_ELEMS(p); \ - if (nextidx_ <= nelems_) \ + if (nextidx_ >= nelems_) \ p = talloc_realloc_size((ctx), p, \ (nextidx_ + 1) * sizeof((p)[0]) * 2);\ } while (0) -- cgit v1.2.3