]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fix mem leak (bug #4318)
authorRussell Bryant <russell@russellbryant.com>
Tue, 31 May 2005 02:57:15 +0000 (02:57 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 31 May 2005 02:57:15 +0000 (02:57 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@5794 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c

index c0747c42ae3ec5c329b0a5727eb97127711c5d56..b3a9c6f9101e3bb6984f604f7d66935c1e52e79c 100755 (executable)
@@ -861,21 +861,30 @@ static struct localuser *wait_for_answer(struct queue_ent *qe, struct localuser
                        if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP))) {
                                /* Got hung up */
                                *to=-1;
+                               if (f)
+                                       ast_frfree(f);
                                return NULL;
                        }
-                       if (f && (f->frametype == AST_FRAME_DTMF) && allowdisconnect_out && (f->subclass == '*')) {
+                       if ((f->frametype == AST_FRAME_DTMF) && allowdisconnect_out && (f->subclass == '*')) {
                            if (option_verbose > 3)
                                        ast_verbose(VERBOSE_PREFIX_3 "User hit %c to disconnect call.\n", f->subclass);
                                *to=0;
+                               if (f)
+                                       ast_frfree(f);  
                                return NULL;
                        }
-                       if (f && (f->frametype == AST_FRAME_DTMF) && (f->subclass != '*') && valid_exit(qe, f->subclass)) {
+                       if ((f->frametype == AST_FRAME_DTMF) && (f->subclass != '*') && valid_exit(qe, f->subclass)) {
                                if (option_verbose > 3)
                                        ast_verbose(VERBOSE_PREFIX_3 "User pressed digit: %c\n", f->subclass);
                                *to=0;
                                *digit=f->subclass;
+                               if (f)
+                                       ast_frfree(f);
                                return NULL;
                        }
+                       if (f)
+                               ast_frfree(f);
+                       
                }
                if (!*to && (option_verbose > 2))
                        ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", orig);