bugFreeciv - Bugs: bug #20007, script_fcdb_init() calls...

 
 
Show feedback again

bug #20007: script_fcdb_init() calls luascript_destroy(NULL)

Submitted by:  Marko Lindqvist <cazfi>
Submitted on:  Mon 30 Jul 2012 04:23:44 PM UTC  
 
Category: generalSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Assigned to: Marko Lindqvist <cazfi>Open/Closed: Closed
Release: Operating System: None
Planned Release: 2.4.0, 2.5.0

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Sat 11 Jan 2014 11:14:26 AM UTC, comment #6:

> Probably related thing I noticed a while ago: if fcdb is
> compiled in but not enabled, a command like
> "/fcdb lua print('Hello')" causes the server to segfault.
> '/fcdb reload' is not particularly happy either. I looked
> briefly at fixing it but it was tangled.

Now covered by bug #21457.

Jacob Nevins <jtn>
Project Administrator
Sun 27 Jan 2013 10:52:09 PM UTC, SVN revision 22219:

Free allocated fc_lua structure if we cannot get state for it and fail out
from luascript_new() Avoid using NULL pointer received from luascript_new().

See gna bug #20007

(Browse SVN revision 22219)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 27 Jan 2013 10:52:03 PM UTC, SVN revision 22218:

Free allocated fc_lua structure if we cannot get state for it and fail out
from luascript_new() Avoid using NULL pointer received from luascript_new().

See gna bug #20007

(Browse SVN revision 22218)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Fri 25 Jan 2013 01:09:00 AM UTC, comment #3:

> I don't know if this harmful or not, but certainly looks
> suspicious.


That particular part is harmless, if redundant. luascript_destroy() checks against NULL parameter and does nothing.

Attached patch removes the redundant call, and also fixes memory leak that has taken place in luascript_new() when it returned NULL.

(file #17018)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 13 Jan 2013 05:10:25 AM UTC, comment #2:

Variable shadowing now handled in patch #3590

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Wed 01 Aug 2012 12:54:47 AM UTC, comment #1:

Probably related thing I noticed a while ago: if fcdb is compiled in but not enabled, a command like "/fcdb lua print('Hello')" causes the server to segfault. '/fcdb reload' is not particularly happy either. I looked briefly at fixing it but it was tangled.

Jacob Nevins <jtn>
Project Administrator
Mon 30 Jul 2012 04:23:44 PM UTC, original submission:

I don't know if this harmful or not, but certainly looks suspicious.

script_fcdb.c:196 checks that fcl certainly is NULL, and then calls luascript_destroy(fcl)

Also, there's shadowing of module wide static variable fcl in some of the functions in this file. Shadowing should be avoided (I remember that we used to get compiler warning about it, wondering why it's not accepted)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #17018:  FreeStatelessFcl.patch added by cazfi (909B - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jtn (Posted a comment)
  • -unavailable- added by cazfi (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 logged-in users can vote.

     

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

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 27 Jan 2013 10:52:28 PM UTCcazfiStatusReady For Test=>Fixed
      Assigned toNone=>cazfi
      Open/ClosedOpen=>Closed
    Fri 25 Jan 2013 01:09:00 AM UTCcazfiAttached File-=>Added FreeStatelessFcl.patch, #17018
      StatusNone=>Ready For Test
      Planned Release=>2.4.0, 2.5.0
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup