manager: Fix HTTP connection reference leaks.
authorCorey Farrell <git@cfware.com>
Sun, 9 Nov 2014 08:01:18 +0000 (08:01 +0000)
committerCorey Farrell <git@cfware.com>
Sun, 9 Nov 2014 08:01:18 +0000 (08:01 +0000)
Fix reference leak that happens if (session && !blastaway).

ASTERISK-24505 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4153/
........

Merged revisions 427641 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 427642 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 427643 from http://svn.asterisk.org/svn/asterisk/branches/13

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@427644 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index ceee37f..6fe12c5 100644 (file)
@@ -7515,11 +7515,16 @@ generic_callback_out:
        ast_free(http_header);
        ast_free(out);
 
-       if (session && blastaway) {
-               session_destroy(session);
-       } else if (session && session->f) {
-               fclose(session->f);
-               session->f = NULL;
+       if (session) {
+               if (blastaway) {
+                       session_destroy(session);
+               } else {
+                       if (session->f) {
+                               fclose(session->f);
+                               session->f = NULL;
+                       }
+                       unref_mansession(session);
+               }
        }
 
        return 0;