All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] avoid glib runtime warning
@ 2016-05-16  6:53 caiwen.zhang
  2016-05-16 15:47 ` Denis Kenzior
  0 siblings, 1 reply; 3+ messages in thread
From: caiwen.zhang @ 2016-05-16  6:53 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]

From: Caiwen Zhang <caiwen.zhang@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);
 
-			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;
 		}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-17  3:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-16  6:53 [PATCH] avoid glib runtime warning caiwen.zhang
2016-05-16 15:47 ` Denis Kenzior
2016-05-17  3:24   ` Zhang, Caiwen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.