• Download Gist
0001-Only-deallocate-the-frame-if-it-isn-t-NULL.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
From 53402e071c7f9d4646bd98c5e5d5e97e69073f3a Mon Sep 17 00:00:00 2001
From: Eric Lindvall <eric@5stops.com>
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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.