clang static analysis

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

clang static analysis

Dmitri A. Sergatskov
I ran a clang-11 static analysis on 2219027f5bd4 (stable).
Results are available at:

Dmitri.
--

Reply | Threaded
Open this post in threaded view
|

Re: clang static analysis

mmuetzel
Am 02. Oktober 2020 um 22:10 Uhr schrieb "Dmitri A. Sergatskov":
> I ran a clang-11 static analysis on 2219027f5bd4 (stable).
> Results are available at:
> https://drive.google.com/file/d/13Qz6svSS4yEwffpNFkd7X-_wQN7ykLky/view?usp=sharing
 
The report indicates that constructs like the following are potential memory leaks:
  double lo = (lims.get ().matrix_value ())(0);

Is that true? Do the intermediate results need a scoped variable?
It might be a false alarm. I don't know how such constructs are reference counted.

Markus



Reply | Threaded
Open this post in threaded view
|

Re: clang static analysis

mmuetzel
In reply to this post by Dmitri A. Sergatskov
Am 02. Oktober 2020 um 22:10 Uhr schrieb "Dmitri A. Sergatskov":
> I ran a clang-11 static analysis on 2219027f5bd4 (stable).
> Results are available at:
> https://drive.google.com/file/d/13Qz6svSS4yEwffpNFkd7X-_wQN7ykLky/view?usp=sharing
 
I pushed a changeset here that hopefully avoids the detected "bad free":
https://hg.savannah.gnu.org/hgweb/octave/rev/02f0649f43d7

Markus


Reply | Threaded
Open this post in threaded view
|

Re: clang static analysis

John W. Eaton
Administrator
On 10/13/20 2:11 PM, Markus Mützel wrote:
> Am 02. Oktober 2020 um 22:10 Uhr schrieb "Dmitri A. Sergatskov":
>> I ran a clang-11 static analysis on 2219027f5bd4 (stable).
>> Results are available at:
>> https://drive.google.com/file/d/13Qz6svSS4yEwffpNFkd7X-_wQN7ykLky/view?usp=sharing
>  
> I pushed a changeset here that hopefully avoids the detected "bad free":
> https://hg.savannah.gnu.org/hgweb/octave/rev/02f0649f43d7

I suppose that change is OK, but I don't think the reference count for
those nil_rep objects can ever be zero, so it seems to me that the
warning could be safely ignored.

jwe