diff options
author | Olivier Guiter <olivier.guiter@linux.intel.com> | 2013-05-29 10:33:10 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-03 11:43:28 +0200 |
commit | b9fce4fe8622ffeb6d3d90b41f3b0a76e60b120b (patch) | |
tree | 814d81b83d9339799a64dd57aecfb25e1520675f | |
parent | cd2b4ce78dade5f3c55f0b871d207592ab12f686 (diff) | |
download | neard-b9fce4fe8622ffeb6d3d90b41f3b0a76e60b120b.tar.gz neard-b9fce4fe8622ffeb6d3d90b41f3b0a76e60b120b.tar.bz2 neard-b9fce4fe8622ffeb6d3d90b41f3b0a76e60b120b.zip |
validation: Fix memory leak from llcp_send_data
When send or sendto fails the SDU still needs to be freed.
-rw-r--r-- | plugins/llcp-validation.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/plugins/llcp-validation.c b/plugins/llcp-validation.c index adad9c0..2239bc9 100644 --- a/plugins/llcp-validation.c +++ b/plugins/llcp-validation.c @@ -86,14 +86,14 @@ static void llcp_free_client(gpointer data) g_free(co_data); } -static void llcp_send_data (gpointer data, gpointer user_data) +static void llcp_send_data(gpointer data, gpointer user_data) { struct co_cl_client_data *clt = user_data; struct sdu *i_sdu = data; int err; if (i_sdu == NULL) - goto out_error; + return; /* conn less or oriented ? */ if (clt->sock_type == SOCK_DGRAM) @@ -103,16 +103,13 @@ static void llcp_send_data (gpointer data, gpointer user_data) else err = send(clt->fd, i_sdu->data, i_sdu->len, 0); - if (err < 0) { + if (err < 0) near_error("Could not send data to client %d", err); - goto out_error; - } + /* free */ clt->sdu_list = g_list_remove(clt->sdu_list, i_sdu); - free_one_sdu(i_sdu); -out_error: return; } |