From fd3a89091c2185feacb76acfb2e69791c1afa592 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 16 Jun 2010 16:49:14 +0200 Subject: Fix previous commit that broke reference to PDU string buffer --- src/stk.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/stk.c b/src/stk.c index b95708e4..b5c69197 100644 --- a/src/stk.c +++ b/src/stk.c @@ -84,27 +84,30 @@ void ofono_stk_proactive_command_notify(struct ofono_stk *stk, { struct stk_command *cmd; char *buf; + int i; buf = g_try_malloc(length * 2 + 1); - if (buf) { - int i; - for (i = 0; i < length; i ++) - sprintf(buf + i * 2, "%02hhx", pdu[i]); - ofono_info("Proactive command PDU: %s", buf); - g_free(buf); - } + if (!buf) + return; + + for (i = 0; i < length; i ++) + sprintf(buf + i * 2, "%02hhx", pdu[i]); cmd = stk_command_new_from_pdu(pdu, length); if (!cmd) { ofono_error("Can't parse proactive command: %s", buf); /* TODO: return TERMINAL RESPONSE with permanent error */ - return; + goto done; } /* TODO: execute */ + ofono_info("Proactive command PDU: %s", buf); stk_command_free(cmd); + +done: + g_free(buf); } int ofono_stk_driver_register(const struct ofono_stk_driver *d) -- cgit v1.2.3