From 7f1fec29d50dce3d26928b7b0c4514b59ca15601 Mon Sep 17 00:00:00 2001 From: Forrest Zhao Date: Mon, 16 Nov 2009 15:06:00 +0800 Subject: [PATCH] obexd: There could be multiple PUT data streams before they're flushed to backend --- obexd/src/obex.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/obexd/src/obex.c b/obexd/src/obex.c index ca8a7bb2c..8d85aa3f6 100644 --- a/obexd/src/obex.c +++ b/obexd/src/obex.c @@ -518,14 +518,9 @@ static gint obex_read_stream(struct obex_session *os, obex_t *obex, } if (os->object == NULL && size > 0) { - if (os->buf) { - error("Got more data but there is still a pending buffer"); - return -EIO; - } - - os->buf = g_malloc0(os->rx_mtu); - memcpy(os->buf, buffer, size); - os->offset = size; + os->buf = g_realloc(os->buf, os->offset + size); + memcpy(os->buf + os->offset, buffer, size); + os->offset += size; debug("Stored %u bytes into temporary buffer", size); -- 2.47.3