[Tarantool-patches] [PATCH luajit 2/2][v2] Followup fix for embedded bytecode loader.
Sergey Bronnikov
sergeyb at tarantool.org
Tue Sep 12 13:30:55 MSK 2023
On 9/11/23 12:26, Sergey Kaplun wrote:
<snipped>
>>>> + static const char *
>>>> + bc_reader_with_eof(lua_State *L, void *data, size_t *size)
>>>> + {
>>>> + UNUSED(L);
>>>> + dt *test_data = (dt *)data;
>>>> + if (test_data->state == EMIT_EOF) {
>>>> + *size = 0;
>>>> + return NULL;
>>>> + }
>>>> +
>>>> + static char *bc_chunk = NULL;
>>>> + free(bc_chunk);
>>> This free is called only once, when bc_chunk is already NULL.
>>> I suggest moving the initialization of the `bc_chunk` to the beginning
>>> of the scope and calling `free()` only for the `EMIT_EOF` state (it's
>>> also a little bit more readable -- a reader shouldn't remember that
>>> `free(NULL)` is OK).
>> Updated.
> Unfortunately, I don't see these changes on branch [1].
Force-pushed.
<snipped>
More information about the Tarantool-patches
mailing list