diff options
author | wm4 <wm4@nowhere> | 2012-09-23 22:10:40 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-10-12 10:10:32 +0200 |
commit | df2b0f99485e065224af89b910370c394d0ef8d0 (patch) | |
tree | 7eb6160c2c77ca42f47779ce5896f3d571be0efd /mpcommon.h | |
parent | 0de86f5bf386e987c0a28dbecdc69155c1abdbcd (diff) | |
download | mpv-df2b0f99485e065224af89b910370c394d0ef8d0.tar.bz2 mpv-df2b0f99485e065224af89b910370c394d0ef8d0.tar.xz |
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.
Diffstat (limited to 'mpcommon.h')
-rw-r--r-- | mpcommon.h | 2 |
1 files changed, 1 insertions, 1 deletions
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) |