Linux bluetooth development
 help / color / mirror / Atom feed
From: Bartosz Szatkowski <bulislaw@linux.com>
To: linux-bluetooth@vger.kernel.org
Cc: Bartosz Szatkowski <bulislaw@linux.com>
Subject: [PATCH obexd] client: Fix app params memory management
Date: Mon, 21 Nov 2011 15:44:47 +0100	[thread overview]
Message-ID: <1321886687-10662-1-git-send-email-bulislaw@linux.com> (raw)

---
 client/transfer.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/client/transfer.c b/client/transfer.c
index b6994d1..b314926 100644
--- a/client/transfer.c
+++ b/client/transfer.c
@@ -356,6 +356,12 @@ static void get_buf_xfer_progress(GObex *obex, GError *err, GObexPacket *rsp,
 	if (hdr) {
 		g_obex_header_get_bytes(hdr, &buf, &len);
 		if (len != 0) {
+			if (transfer->params == NULL)
+				transfer->params =
+					g_new0(struct obc_transfer_params, 1);
+			else if (transfer->params->data != NULL)
+				g_free(transfer->params->data);
+
 			transfer->params->data = g_memdup(buf, len);
 			transfer->params->size = len;
 		}
-- 
1.7.4.1


             reply	other threads:[~2011-11-21 14:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-21 14:44 Bartosz Szatkowski [this message]
2011-11-21 18:42 ` [PATCH obexd] client: Fix app params memory management Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321886687-10662-1-git-send-email-bulislaw@linux.com \
    --to=bulislaw@linux.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox