fix leaks reported by valgrind.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sun, 15 Jul 2012 07:42:35 +0000 (04:42 -0300)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sun, 15 Jul 2012 07:42:35 +0000 (04:42 -0300)
forgot to free the callback context after it was dispatched to user.

dialer/ofono.c

index 99c4175..8af019f 100644 (file)
@@ -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,