Return-Path: From: Mikel Astiz To: linux-bluetooth@vger.kernel.org Cc: Mikel Astiz Subject: [PATCH obexd 1/6] client: fix memory leak in obc_session_put Date: Mon, 13 Feb 2012 15:39:00 +0100 Message-Id: <1329143945-4934-1-git-send-email-mikel.astiz.oss@gmail.com> Sender: linux-bluetooth-owner@vger.kernel.org List-ID: From: Mikel Astiz obc_session_put takes ownership of the given buffer, but did not free the memory in case of error. --- client/session.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/session.c b/client/session.c index 585e402..cb46510 100644 --- a/client/session.c +++ b/client/session.c @@ -1007,8 +1007,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); @@ -1016,8 +1018,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); -- 1.7.6.5