All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH obexd] client: Fix app params memory management
@ 2011-11-21 14:44 Bartosz Szatkowski
  2011-11-21 18:42 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Bartosz Szatkowski @ 2011-11-21 14:44 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bartosz Szatkowski

---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH obexd] client: Fix app params memory management
  2011-11-21 14:44 [PATCH obexd] client: Fix app params memory management Bartosz Szatkowski
@ 2011-11-21 18:42 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-11-21 18:42 UTC (permalink / raw)
  To: Bartosz Szatkowski; +Cc: linux-bluetooth

Hi Bartosz,

On Mon, Nov 21, 2011, Bartosz Szatkowski wrote:
> ---
>  client/transfer.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)

Applied after a minor fix (you don't need to check for NULL before
calling g_free). Thanks.

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-21 18:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-21 14:44 [PATCH obexd] client: Fix app params memory management Bartosz Szatkowski
2011-11-21 18:42 ` Johan Hedberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.