(movie.c) Try to be more safe in init_playback

This commit is contained in:
twinaphex 2017-01-22 18:22:45 +01:00
parent 2f504b4057
commit f770ea8560

10
movie.c
View File

@ -110,14 +110,16 @@ static bool init_playback(bsv_movie_t *handle, const char *path)
if (state_size)
{
retro_ctx_serialize_info_t serial_info;
retro_ctx_size_info_t info;
retro_ctx_serialize_info_t serial_info;
uint8_t *buf = (uint8_t*)malloc(state_size);
handle->state = (uint8_t*)malloc(state_size);
handle->state_size = state_size;
if (!handle->state)
if (!buf)
return false;
handle->state = buf;
handle->state_size = state_size;
if (fread(handle->state, 1, state_size, handle->file) != state_size)
{
RARCH_ERR("%s\n", msg_hash_to_str(MSG_COULD_NOT_READ_STATE_FROM_MOVIE));