From 5655cb9c501a5ba2ef0131ec13116c54dcdd3c98 Mon Sep 17 00:00:00 2001 From: Mikel Astiz Date: Fri, 17 Feb 2012 13:55:31 +0100 Subject: [PATCH] obexd: fix memory leak in obc_session_put obc_session_put takes ownership of the given buffer, but did not free the memory in case of error. --- obexd/client/session.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/obexd/client/session.c b/obexd/client/session.c index 0fa8efcd8..28516b2cb 100644 --- a/obexd/client/session.c +++ b/obexd/client/session.c @@ -1017,8 +1017,10 @@ int obc_session_put(struct obc_session *session, char *buf, const char *targetna struct obc_transfer *transfer; const char *agent; - if (session->obex == NULL) + if (session->obex == NULL) { + g_free(buf); return -ENOTCONN; + } agent = obc_agent_get_name(session->agent); @@ -1026,8 +1028,10 @@ int obc_session_put(struct obc_session *session, char *buf, const char *targetna agent, NULL, targetname, NULL, NULL); - if (transfer == NULL) + if (transfer == NULL) { + g_free(buf); return -EIO; + } obc_transfer_set_buffer(transfer, buf); -- 2.47.3