Hi Caiwen,
On 05/16/2016 01:53 AM, caiwen.zhang(a)intel.com wrote:
From: Caiwen Zhang <caiwen.zhang(a)intel.com>
When set modem power off, in the callback of the request gril is cleaned
up, 'out_queue' and 'command_queue' is NULL. If don't check before
use
them, there will be glib runtime warning.
---
gril/gril.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/gril/gril.c b/gril/gril.c
index 297a772..34cadbb 100644
--- a/gril/gril.c
+++ b/gril/gril.c
@@ -374,7 +374,10 @@ static void handle_response(struct ril_s *p, struct ril_msg
*message)
if (req->callback)
req->callback(message, req->user_data);
Can we simply return if p->destroyed is set to true instead?
- len = g_queue_get_length(p->out_queue);
+ if (p->out_queue)
+ len = g_queue_get_length(p->out_queue);
+ else
+ len = 0;
for (i = 0; i < len; i++) {
id = GPOINTER_TO_INT(g_queue_peek_nth(
@@ -387,8 +390,10 @@ static void handle_response(struct ril_s *p, struct ril_msg
*message)
ril_request_destroy(req);
- if (g_queue_peek_head(p->command_queue))
- ril_wakeup_writer(p);
+ if (p->command_queue) {
+ if (g_queue_peek_head(p->command_queue))
+ ril_wakeup_writer(p);
+ }
break;
}
Regards,
-Denis