This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Crash free()ing unallocated memory.


On Thu, Nov 6, 2008 at 12:09 PM, Tom Tromey <tromey@redhat.com> wrote:

> Could you try the appended?  This implements the above idea and also
> fixes another oddity -- I think the prev and next fields were not
> always initialized.
>
> If this works for you, I will check it in.

This almost fixes it.
The missing piece is this one:

@@ -376,7 +376,8 @@ typy_dealloc (PyObject *obj)
            {
              /* Must reset head of list.  */
              struct objfile *objfile = TYPE_OBJFILE (type->type);
-             set_objfile_data (objfile, typy_objfile_data_key, type->next);
+             if (objfile)
+               set_objfile_data (objfile, typy_objfile_data_key, type->next);
            }

With above, the crash is gone, and Valgrind is happy.
Full corrected patch attached.

Thanks,
-- 
Paul Pluzhnikov

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]