From 68e6127c8dea2216837dbfbcd213cc6a5191629b Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Sun, 15 Jul 2012 04:42:35 -0300 Subject: [PATCH] fix leaks reported by valgrind. forgot to free the callback context after it was dispatched to user. --- dialer/ofono.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dialer/ofono.c b/dialer/ofono.c index 99c4175..8af019f 100644 --- a/dialer/ofono.c +++ b/dialer/ofono.c @@ -183,8 +183,10 @@ static void _ofono_simple_reply(void *data, DBusMessage *msg __UNUSED__, e = _ofono_error_parse(err->name); } - if (ctx) + if (ctx) { ctx->cb((void *)ctx->data, e); + free(ctx); + } } typedef struct _OFono_String_Cb_Context @@ -216,6 +218,7 @@ static void _ofono_string_reply(void *data, DBusMessage *msg, DBusError *err) DBG("%s %s", ctx->name, str); free(str); + free(ctx); } struct _OFono_Pending @@ -1748,6 +1751,8 @@ static void _ofono_dial_reply(void *data, DBusMessage *msg, DBusError *err) if (ctx->cb) ctx->cb((void *)ctx->data, oe, c); + + free(ctx); } OFono_Pending *ofono_dial(const char *number, const char *hide_callerid, -- 2.7.4