bugGNU Octave - Bugs: bug #34808, atexit double free

 
 

bug #34808: atexit double free

Submitted by:  None
Submitted on:  Sat 12 Nov 2011 02:38:58 AM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Segfault, Bus Error, etc.
Status: NoneAssigned to: None
Originator Name: Kyle HusmannOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.4.3
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 16 Nov 2011 08:11:35 PM UTC, comment #3:

Ok. I'll close this bug report. If for some reason it needs to reopened come back and leave a comment and I or someone can take care of that.

Thanks.

Ben Abbott <bpabbott>
Project Member
Wed 16 Nov 2011 07:40:56 PM UTC, comment #2:

Ah, sorry, it appears I'm not using the embedded mode as it was intended. By calling do_octave_exit() before I let my program exit, the problem is fixed.

I had assumed calling do_octave_exit() was unnecessary to call in my code because it was registered with atexit() when octave_main() was called, but I was wrong.

Kyle Husmann <khusmann>
Tue 15 Nov 2011 02:17:59 AM UTC, comment #1:

Kyle,

I'm not a competent c++ programer, so I can't provide a patch, but I can test one on OSX Lion and Ubuntu.

Are you interested to working on a patch?

Ben Abbott <bpabbott>
Project Member
Sat 12 Nov 2011 02:38:58 AM UTC, original submission:

I have a program that links to octave. All it does is calls octave_main with embedded = true, nothing else (attached). In Linux it appears to run fine, but on OSX when the program exits, it complains:

This is actually a sign of a deeper problem. The problem is that do_octave_exit() is registered with atexit() by octave_main() (octave.cc:830) BEFORE the static memory in functions like octave_read is initialized. This is a problem, because according to the C++ standard,

So, a double free is basically happening. To fix this, I suppose functions like octave_read should be called to initialize their static data BEFORE do_octave_exit() is registered with atexit()

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #24359:  bug.cc added by None (272B - text/x-c++src)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by khusmann (Posted a comment)
  • -unavailable- added by bpabbott (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 16 Nov 2011 08:11:35 PM UTCbpabbottOpen/ClosedOpen=>Closed
    Sat 12 Nov 2011 02:38:58 AM UTCNoneAttached File-=>Added bug.cc, #24359

    Back to the top


    Powered by Savane 3.1-cleanup1