diff options
Diffstat (limited to '')
-rw-r--r-- | ltable.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -632,14 +632,14 @@ static Value *resizearray (lua_State *L , Table *t, | |||
632 | if (np == NULL) /* allocation error? */ | 632 | if (np == NULL) /* allocation error? */ |
633 | return NULL; | 633 | return NULL; |
634 | if (oldasize > 0) { | 634 | if (oldasize > 0) { |
635 | size_t oldasizeb = concretesize(oldasize); | ||
635 | /* move common elements to new position */ | 636 | /* move common elements to new position */ |
636 | Value *op = t->array - oldasize; /* real original array */ | 637 | Value *op = t->array - oldasize; /* real original array */ |
637 | unsigned tomove = (oldasize < newasize) ? oldasize : newasize; | 638 | unsigned tomove = (oldasize < newasize) ? oldasize : newasize; |
638 | lua_assert(tomove > 0); | 639 | size_t tomoveb = (oldasize < newasize) ? oldasizeb : newasizeb; |
639 | memcpy(np + newasize - tomove, | 640 | lua_assert(tomoveb > 0); |
640 | op + oldasize - tomove, | 641 | memcpy(np + newasize - tomove, op + oldasize - tomove, tomoveb); |
641 | concretesize(tomove)); | 642 | luaM_freemem(L, op, oldasizeb); |
642 | luaM_freemem(L, op, concretesize(oldasize)); | ||
643 | } | 643 | } |
644 | return np + newasize; /* shift pointer to the end of value segment */ | 644 | return np + newasize; /* shift pointer to the end of value segment */ |
645 | } | 645 | } |