mirror of
https://github.com/mpv-player/mpv
synced 2024-08-24 07:21:49 +02:00
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.
This commit is contained in:
parent
0de86f5bf3
commit
df2b0f9948
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user