How many times can we free allocated memory? Many, obviously... ;-)
authorOlle Johansson <oej@edvina.net>
Tue, 20 Jun 2006 21:12:58 +0000 (21:12 +0000)
committerOlle Johansson <oej@edvina.net>
Tue, 20 Jun 2006 21:12:58 +0000 (21:12 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@35160 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 7e137d2..92a3717 100644 (file)
@@ -12089,10 +12089,10 @@ static int sip_park(struct ast_channel *chan1, struct ast_channel *chan2, struct
                d->chan2 = transferer;  /* Transferer */
                d->seqno = seqno;
                if (!ast_pthread_create(&th, NULL, sip_park_thread, d)) {
-                       free(d);
+                       free(d);        /* We don't need it anymore. If thread is created, d will be free'd
+                                          by sip_park_thread() */
                        return 0;
                }
-               free(d);
        } 
        return -1;
 }