Properly clean up zlib.

This commit is contained in:
Gregor Richards 2016-10-30 14:45:31 -04:00
parent 3ff22c9ed6
commit 679ea058a4
1 changed files with 2 additions and 2 deletions

View File

@ -672,6 +672,7 @@ static bool netplay_get_cmd(netplay_t *netplay)
RARCH_ERR("CMD_LOAD_SAVESTATE received too-short savestate.\n"); RARCH_ERR("CMD_LOAD_SAVESTATE received too-short savestate.\n");
return netplay_cmd_nak(netplay); return netplay_cmd_nak(netplay);
} }
inflateEnd(&stream);
/* Skip ahead if it's past where we are */ /* Skip ahead if it's past where we are */
if (frame > netplay->self_frame_count) if (frame > netplay->self_frame_count)
@ -1499,16 +1500,15 @@ void netplay_load_savestate(netplay_t *netplay,
stream.avail_out = netplay->zbuffer_size; stream.avail_out = netplay->zbuffer_size;
if (deflate(&stream, 1) == Z_STREAM_ERROR) if (deflate(&stream, 1) == Z_STREAM_ERROR)
{ {
fprintf(stderr, "OH NO! %s\n", stream.msg);
hangup(netplay); hangup(netplay);
return; return;
} }
if (stream.total_in != serial_info->size) if (stream.total_in != serial_info->size)
{ {
fprintf(stderr, "OH NO 2! %u %u\n", (unsigned) stream.total_in, (unsigned) serial_info->size);
hangup(netplay); hangup(netplay);
return; return;
} }
deflateEnd(&stream);
/* And send it to the peer */ /* And send it to the peer */
header[0] = htonl(NETPLAY_CMD_LOAD_SAVESTATE); header[0] = htonl(NETPLAY_CMD_LOAD_SAVESTATE);