#77 Fix crash on exit when swapfile was used

CVS
closed
nobody
General (21)
5
2008-10-23
2007-02-14
Dan Nelson
No

Occasionally after editing a large file (over 32MB), joe will coredump on exit and leave its swapfile hanging around. I think the cause is that path.c:mktmp() allocates a stack Obj string for the filename, but since the allocation is done between the "startup_gc = vsmk(1)" at main.c:634 and the "obj_free(startup_gc)" at main.c:707, the filename gets freed, and vmem->name is now a dangling pointer to freed memory. Depending on what the user does after this point, and whether the OS fills freed memory, this can cause a crash inside the "vclose(vmem)" call at main.c:719 when vclose() tries to free vfile->name.

The fix is for mktmp() to call obj_perm(name) before returning, to keep it from getting gc'd.

Discussion

  • Dan Nelson
    Dan Nelson
    2007-02-14

    patch to path.c

     
    Attachments
  • Joe Allen
    Joe Allen
    2007-03-16

    Logged In: YES
    user_id=1000448
    Originator: NO

    Thanks for this. The stack objects are supposed to make this kind of bug less frequent.

     
  • Joe Allen
    Joe Allen
    2008-10-23

    • status: open --> closed