summaryrefslogtreecommitdiff
path: root/client/session.c
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2012-02-17 13:55:31 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-17 16:26:06 +0200
commitc567ed52e81b733be069a23d856112683946addf (patch)
tree5b13562dc6997a4edd7cd58fc14050b4908e2568 /client/session.c
parenta1d9f111f39d5a39b618bbeeaf3553b92fda2008 (diff)
downloadobexd-c567ed52e81b733be069a23d856112683946addf.tar.gz
client: 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.
Diffstat (limited to 'client/session.c')
-rw-r--r--client/session.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/client/session.c b/client/session.c
index 0fa8efc..28516b2 100644
--- a/client/session.c
+++ b/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);