Re: [PATCH] netmon: Make sure we don't pass NULL message to g_dbus_send_message

2016-10-25 Thread Denis Kenzior

Hi Slava,

On 10/14/2016 11:32 AM, Slava Monich wrote:

Also that we don't lose the reply message.
---
  src/netmon.c | 17 -
  1 file changed, 16 insertions(+), 1 deletion(-)



Applied, thanks.

Regards,
-Denis

___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono


[PATCH] netmon: Make sure we don't pass NULL message to g_dbus_send_message

2016-10-14 Thread Slava Monich
Also that we don't lose the reply message.
---
 src/netmon.c | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/netmon.c b/src/netmon.c
index 9d6de07..eb18b9c 100644
--- a/src/netmon.c
+++ b/src/netmon.c
@@ -199,9 +199,24 @@ static void serving_cell_info_callback(const struct 
ofono_error *error,
struct ofono_netmon *netmon = data;
DBusMessage *reply = netmon->reply;
 
-   if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
+   if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+   if (reply)
+   dbus_message_unref(reply);
+
reply = __ofono_error_failed(netmon->pending);
+} else if (!reply) {
+   DBusMessageIter iter;
+   DBusMessageIter dict;
+
+   reply = dbus_message_new_method_return(netmon->pending);
+   dbus_message_iter_init_append(reply, );
+   dbus_message_iter_open_container(, DBUS_TYPE_ARRAY,
+   OFONO_PROPERTIES_ARRAY_SIGNATURE,
+   );
+   dbus_message_iter_close_container(, );
+   }
 
+   netmon->reply = NULL;
__ofono_dbus_pending_reply(>pending, reply);
 }
 
-- 
1.9.1

___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono