Skip to contentSkip to conversation

stk: Fix crash seen in stk_alpha_id_unset

PATCH In review Jeevaka Badrappan 2 participants 2 messages Jul 15, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stk: Fix crash seen in stk_alpha_id_unset

If there is no default agent, then current agent also will be NULL. So, call stk_agent_request_cancel only when there is a valid current agent.

---
 src/stk.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
src/stk.c +6 -1
index 4df23b5..e8ffb42 100644
@@ -529,7 +529,12 @@ static void stk_alpha_id_set(struct ofono_stk *stk,
 
 static void stk_alpha_id_unset(struct ofono_stk *stk)
 {
-	stk_agent_request_cancel(stk->current_agent);
+	/*
+	 * If there is no default agent, then current agent also will be NULL.
+	 * So, call request cancel only when there is a valid current agent.
+	 */
+	if (stk->current_agent)
+		stk_agent_request_cancel(stk->current_agent);
 }
 
 static int duration_to_msecs(const struct stk_duration *duration)
Signature · 1 line
1.7.4.1
#1 lore raw

Hi Jeevaka,

Quoted 7 lines · Jeevaka Badrappan

If there is no default agent, then current agent also will be NULL. So, call stk_agent_request_cancel only when there is a valid current agent.

---
 src/stk.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis