Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eric/996020 to your computer and use it in GitHub Desktop.
Save eric/996020 to your computer and use it in GitHub Desktop.
From 53402e071c7f9d4646bd98c5e5d5e97e69073f3a Mon Sep 17 00:00:00 2001
From: Eric Lindvall <[email protected]>
Date: Fri, 27 May 2011 12:46:00 -0700
Subject: [PATCH] Only deallocate the frame if it isn't NULL.
---
app_swift.c | 40 +++++++++++++++++++++-------------------
1 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/app_swift.c b/app_swift.c
index 29b24e7..4f67c37 100644
--- a/app_swift.c
+++ b/app_swift.c
@@ -409,27 +409,29 @@ static int app_exec(struct ast_channel *chan, void *data)
ASTOBJ_WRLOCK(ps);
ps->immediate_exit = 1;
ASTOBJ_UNLOCK(ps);
- } else if (f->frametype == AST_FRAME_DTMF && timeout > 0 && max_digits > 0) {
- char originDTMF = f->subclass;
- alreadyran = 1;
- res = 0;
- ASTOBJ_WRLOCK(ps);
- ps->immediate_exit = 1;
- ASTOBJ_UNLOCK(ps);
-
- if (max_digits > 1) {
- rc = listen_for_dtmf(chan, timeout, max_digits - 1);
- }
- if (rc) {
- sprintf(results, "%c%s", originDTMF, rc);
- } else {
- sprintf(results, "%c", originDTMF);
+ } else {
+ if (f->frametype == AST_FRAME_DTMF && timeout > 0 && max_digits > 0) {
+ char originDTMF = f->subclass;
+ alreadyran = 1;
+ res = 0;
+ ASTOBJ_WRLOCK(ps);
+ ps->immediate_exit = 1;
+ ASTOBJ_UNLOCK(ps);
+
+ if (max_digits > 1) {
+ rc = listen_for_dtmf(chan, timeout, max_digits - 1);
+ }
+ if (rc) {
+ sprintf(results, "%c%s", originDTMF, rc);
+ } else {
+ sprintf(results, "%c", originDTMF);
+ }
+
+ ast_log(LOG_NOTICE, "DTMF = %s\n", results);
+ pbx_builtin_setvar_helper(chan, "SWIFT_DTMF", results);
}
-
- ast_log(LOG_NOTICE, "DTMF = %s\n", results);
- pbx_builtin_setvar_helper(chan, "SWIFT_DTMF", results);
+ ast_frfree(f);
}
- ast_frfree(f);
}
}
--
1.7.5.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment