Merge pull request #11736 from SimpleTease/netplay_2

netplay: allocate crashfix
This commit is contained in:
Autechre 2020-12-23 03:29:02 +01:00 committed by GitHub
commit 84d75783ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,7 +158,10 @@ netplay_input_state_t netplay_input_state_for(
return NULL;
/* Couldn't find a slot, allocate a fresh one */
ret = (netplay_input_state_t)calloc(1, sizeof(struct netplay_input_state) + (size-1) * sizeof(uint32_t));
if (size > 1)
ret = (netplay_input_state_t)calloc(1, sizeof(struct netplay_input_state) + (size-1) * sizeof(uint32_t));
else
ret = (netplay_input_state_t)calloc(1, sizeof(struct netplay_input_state));
if (!ret)
return NULL;
*list = ret;