summaryrefslogtreecommitdiff
path: root/obexd/plugins/phonebook-ebook.c
diff options
context:
space:
mode:
authorBartosz Szatkowski <bulislaw@linux.com>2011-07-13 22:10:10 +0000
committerMarcel Holtmann <marcel@holtmann.org>2012-12-04 22:48:40 +0100
commit88a72d54ff1a30d18697dc89b075ea0c412007ca (patch)
tree1624383582131932e986c24d83842255d1021042 /obexd/plugins/phonebook-ebook.c
parent934d1c4d3cd1a176c8ab067f444b675d51b0e210 (diff)
obexd: Fix freeing buffer before transfer is complete
phonebook_req_finalize is called before actual transport taking place, so buffers kept in user_data may cause invalid reads in valgrind and prevent transport being completed.
Diffstat (limited to 'obexd/plugins/phonebook-ebook.c')
-rw-r--r--obexd/plugins/phonebook-ebook.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/obexd/plugins/phonebook-ebook.c b/obexd/plugins/phonebook-ebook.c
index 06ae1ec1e..4a14eca12 100644
--- a/obexd/plugins/phonebook-ebook.c
+++ b/obexd/plugins/phonebook-ebook.c
@@ -208,9 +208,15 @@ done:
DBG("collected %d vcards", count);
data->queued_calls--;
- if (data->queued_calls == 0)
- data->contacts_cb(data->buf->str, data->buf->len, data->count,
+ if (data->queued_calls == 0) {
+ GString *buf = data->buf;
+ data->buf = NULL;
+
+ data->contacts_cb(buf->str, buf->len, data->count,
0, TRUE, data->user_data);
+
+ g_string_free(buf, TRUE);
+ }
}
static void ebook_entry_cb(EBook *book, const GError *gerr,