summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-06-16 16:49:14 +0200
committerMarcel Holtmann <marcel@holtmann.org>2010-06-16 16:49:14 +0200
commitfd3a89091c2185feacb76acfb2e69791c1afa592 (patch)
treea769283558107ed1dfd8dbc90d92794f94a6852d
parente2790ba6465e956a167b1e2622641d941c721a51 (diff)
downloadofono-fd3a89091c2185feacb76acfb2e69791c1afa592.tar.bz2
Fix previous commit that broke reference to PDU string buffer
-rw-r--r--src/stk.c19
1 files changed, 11 insertions, 8 deletions
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)