]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 371691 via svnmerge from
authorAutomerge script <automerge@asterisk.org>
Mon, 27 Aug 2012 14:26:37 +0000 (14:26 +0000)
committerAutomerge script <automerge@asterisk.org>
Mon, 27 Aug 2012 14:26:37 +0000 (14:26 +0000)
file:///srv/subversion/repos/asterisk/branches/10

................
  r371691 | kmoore | 2012-08-27 08:57:10 -0500 (Mon, 27 Aug 2012) | 14 lines

  Implement workaround for BETTER_BACKTRACES crash

  When compiling with BETTER_BACKTRACES enabled, Asterisk will sometimes
  crash when "core show locks" is run. This happens regularly in the
  testsuite since several tests run "core show locks" to help with
  debugging. This seems to be a fault with libraries on certain operating
  systems (notably CentOS 6.2/6.3) running on virtual machines and
  utilizing gcc 4.4.6.

  (closes issue ASTERISK-20090)
  ........

  Merged revisions 371690 from http://svn.asterisk.org/svn/asterisk/branches/1.8
................

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

main/utils.c

index 07084ce9a03c64c5e87d1867661edb3f469f5a17..a679ee15ec8ca7260fa5b98df0e43a8dc8c49f3f 100644 (file)
@@ -776,16 +776,20 @@ static const char *locktype2str(enum ast_lock_type type)
 static void append_backtrace_information(struct ast_str **str, struct ast_bt *bt)
 {
        char **symbols;
+       int num_frames;
 
        if (!bt) {
                ast_str_append(str, 0, "\tNo backtrace to print\n");
                return;
        }
 
-       if ((symbols = ast_bt_get_symbols(bt->addresses, bt->num_frames))) {
+       /* store frame count locally to avoid the memory corruption that
+        * sometimes happens on virtualized CentOS 6.x systems */
+       num_frames = bt->num_frames;
+       if ((symbols = ast_bt_get_symbols(bt->addresses, num_frames))) {
                int frame_iterator;
                
-               for (frame_iterator = 0; frame_iterator < bt->num_frames; ++frame_iterator) {
+               for (frame_iterator = 0; frame_iterator < num_frames; ++frame_iterator) {
                        ast_str_append(str, 0, "\t%s\n", symbols[frame_iterator]);
                }