octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #55440] clang's scan-build static analysis rep


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #55440] clang's scan-build static analysis report
Date: Sat, 12 Jan 2019 11:33:46 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0

Follow-up Comment #3, bug #55440 (project octave):

The analyser might have a point that there is something off with the "Bad
free" in oct-shlib.h: "delete" might be called on the static nil_rep.
This might be a fix:

diff -r 8b0c9dc0799a liboctave/util/oct-shlib.h
--- a/liboctave/util/oct-shlib.h        Fri Jan 11 15:22:59 2019 -0500
+++ b/liboctave/util/oct-shlib.h        Sat Jan 12 16:33:32 2019 +0100
@@ -126,7 +126,7 @@
 
     ~dynamic_library (void)
     {
-      if (--rep->count == 0)
+      if (--rep->count == 0 && rep != nilrep)
         delete rep;
     }
 
@@ -140,7 +140,7 @@
     {
       if (rep != sl.rep)
         {
-          if (--rep->count == 0)
+          if (--rep->count == 0 && rep != nilrep)
             delete rep;
 
           rep = sl.rep;


But I am not sure whether I am following the code correctly. And I don't know
whether we have to be more careful with the reference count of the nilrep.
Could someone else please check?

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55440>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]