]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Workaround for what is probably a glibc bug (but we'll see this crop up again
authorTilghman Lesher <tilghman@meg.abyt.es>
Wed, 26 Dec 2007 20:43:38 +0000 (20:43 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Wed, 26 Dec 2007 20:43:38 +0000 (20:43 +0000)
and again, if we don't add the workaround).
Reported by: rolek
Patch by: tilghman
(Closes issue #11601, closes issue #11426)

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

main/manager.c

index 8306347921ae745c095b01248b7c150dbc1d2f85..6d7cc3fc1abf6a1958095daa9e516f5741d45a06 100644 (file)
@@ -2283,6 +2283,14 @@ static void *session_do(void *data)
                }
                ast_log(LOG_EVENT, "Failed attempt from %s\n", ast_inet_ntoa(s->sin.sin_addr));
        }
+
+       /* If the entire session occurs in a single context switch, then it's
+        * possible to get an unsafe memory condition by free()ing the memory
+        * before letting other threads run at least once.  This actually seems
+        * like a workaround for a glibc bug.
+        */
+       usleep(1);
+
        destroy_session(s);
        return NULL;
 }