fix leak of SCP_DISCONNECTED_SESSION

Pointed out by: #919
master
Koichiro IWAO 7 years ago
parent f763cb3788
commit e16029cbc2
No known key found for this signature in database
GPG Key ID: 9F72CDBC01BF10EB

@ -177,6 +177,7 @@ scp_v1c_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, 8)) if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, 8))
{ {
g_free(ds);
return SCP_CLIENT_STATE_NETWORK_ERR; return SCP_CLIENT_STATE_NETWORK_ERR;
} }
@ -184,6 +185,7 @@ scp_v1c_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (version != 1) if (version != 1)
{ {
g_free(ds);
return SCP_CLIENT_STATE_VERSION_ERR; return SCP_CLIENT_STATE_VERSION_ERR;
} }
@ -191,6 +193,7 @@ scp_v1c_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (size < 12) if (size < 12)
{ {
g_free(ds);
return SCP_CLIENT_STATE_SIZE_ERR; return SCP_CLIENT_STATE_SIZE_ERR;
} }
@ -198,6 +201,7 @@ scp_v1c_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, size - 8)) if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, size - 8))
{ {
g_free(ds);
return SCP_CLIENT_STATE_NETWORK_ERR; return SCP_CLIENT_STATE_NETWORK_ERR;
} }
@ -205,6 +209,7 @@ scp_v1c_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (cmd != SCP_COMMAND_SET_DEFAULT) if (cmd != SCP_COMMAND_SET_DEFAULT)
{ {
g_free(ds);
return SCP_CLIENT_STATE_SEQUENCE_ERR; return SCP_CLIENT_STATE_SEQUENCE_ERR;
} }
@ -212,6 +217,7 @@ scp_v1c_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (cmd != 42) if (cmd != 42)
{ {
g_free(ds);
return SCP_CLIENT_STATE_SEQUENCE_ERR; return SCP_CLIENT_STATE_SEQUENCE_ERR;
} }

@ -144,6 +144,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, 8)) if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, 8))
{ {
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__); log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
g_free(ds);
return SCP_CLIENT_STATE_NETWORK_ERR; return SCP_CLIENT_STATE_NETWORK_ERR;
} }
@ -152,6 +153,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (version != 1) if (version != 1)
{ {
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: version error", __LINE__); log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: version error", __LINE__);
g_free(ds);
return SCP_CLIENT_STATE_VERSION_ERR; return SCP_CLIENT_STATE_VERSION_ERR;
} }
@ -160,6 +162,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (size < 12) if (size < 12)
{ {
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: size error", __LINE__); log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: size error", __LINE__);
g_free(ds);
return SCP_CLIENT_STATE_SIZE_ERR; return SCP_CLIENT_STATE_SIZE_ERR;
} }
@ -168,6 +171,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, size - 8)) if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, size - 8))
{ {
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__); log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
g_free(ds);
return SCP_CLIENT_STATE_NETWORK_ERR; return SCP_CLIENT_STATE_NETWORK_ERR;
} }
@ -176,6 +180,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (cmd != SCP_COMMAND_SET_MANAGE) if (cmd != SCP_COMMAND_SET_MANAGE)
{ {
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: sequence error", __LINE__); log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: sequence error", __LINE__);
g_free(ds);
return SCP_CLIENT_STATE_SEQUENCE_ERR; return SCP_CLIENT_STATE_SEQUENCE_ERR;
} }
@ -184,6 +189,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (cmd != SCP_CMD_MNG_LIST) /* session list */ if (cmd != SCP_CMD_MNG_LIST) /* session list */
{ {
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: sequence error", __LINE__); log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: sequence error", __LINE__);
g_free(ds);
return SCP_CLIENT_STATE_SEQUENCE_ERR; return SCP_CLIENT_STATE_SEQUENCE_ERR;
} }

Loading…
Cancel
Save