Fix a crash in tcp and tls connections related to reference counts.
authorBrett Bryant <bbryant@digium.com>
Wed, 18 Jun 2008 20:07:56 +0000 (20:07 +0000)
committerBrett Bryant <bbryant@digium.com>
Wed, 18 Jun 2008 20:07:56 +0000 (20:07 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123692 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/tcptls.c

index 9ce3ac9..f51a447 100644 (file)
@@ -276,6 +276,7 @@ struct ast_tcptls_session_instance *ast_tcptls_client_start(struct server_args *
                __ssl_setup(desc->tls_cfg, 1);
        }
 
+       ao2_ref(ser, +1);
        if (!ast_make_file_from_fd(ser))
                goto error;
 
@@ -460,7 +461,7 @@ void *ast_make_file_from_fd(void *data)
        if (!ser->f) {
                close(ser->fd);
                ast_log(LOG_WARNING, "FILE * open failed!\n");
-               ast_free(ser);
+               ao2_ref(ser, -1);
                return NULL;
        }