[Dune] [#738] starcdreadertest fails

Dune flyspray at dune-project.org
Wed Feb 17 00:15:44 CET 2010


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

The following task has a new comment added:

FS#738 - starcdreadertest fails
User who did this - Oliver Sander (sander)

----------
That is a nice bug! Here is what's happening: when shutting down, UG (in the method ddd_TypeMgrExit) deletes heap memory, but doesn't set the pointer to zero.  In most cases this doesn't matter, because you're exiting anyways.  However, when, in Dune, you create a UGGrid object and delete it again, and create another one, you initialize UG, shut if off, and initialize it again.  Now the pointer you have failed to set to zero is static, so on the second iteration it is still there, but the memory it points to has been deleted.  So when UG shuts down a second time the double free occurs.

There are some things about this that I do not understand. But the following patch (which I just committed)

--- typemgr.c   (Revision 8363)
+++ typemgr.c   (Arbeitskopie)
@@ -1837,8 +1837,10 @@
        /* free memory */
        for(i=0; i<nDescr; i++)
        {
-               if (theTypeDefs[i].cmask!=NULL)
-                       FreeFix(theTypeDefs[i].cmask);
+            if (theTypeDefs[i].cmask!=NULL) {
+                       FreeFix(theTypeDefs[i].cmask);
+                theTypeDefs[i].cmask = NULL;
+            }
        }
 }

looks very reasonable and does solve the problem.
----------

More information can be found at the following URL:
http://www.dune-project.org/flyspray/index.php?do=details&task_id=738#comment1754

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.




More information about the Dune mailing list