← Back to team overview

kicad-developers team mailing list archive

Re: Some malloc diagnostics

 

Yes, only wxPython.  (it was first in the brew build script)

Am currently running analysis on kicad code. (It had quit before - perhaps it was something I did)

Regards

Bob G

On 02/03/2015 10:42 AM, Bernhard Stegmaier wrote:

I might be wrong but this seems to be only wxWidgets stuff... you should better post it there for being fixed?

Regards,
Bernhard

On 2015-02-03 17:26, Bob Gustafson wrote:

The diagnostics below were from a static analysis using scan-build on my Mac.

They might be useful.

/private/tmp/kicad-PZ3oZb/wx/src/regex/regcomp.c:339:19: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'struct guts'
        re->re_guts = VS(MALLOC(sizeof(struct guts)));
                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/kicad-PZ3oZb/wx/src/regex/regguts.h:96:19: note: expanded from macro 'MALLOC'
#define MALLOC(n)       malloc(n)
                        ^~~~~~
/private/tmp/kicad-PZ3oZb/wx/src/regex/regguts.h:74:24: note: expanded from macro 'VS' #define VS(x) ((PVOID)(x)) /* cast something to generic ptr */
                         ^
/private/tmp/kicad-PZ3oZb/wx/src/regex/regcomp.c:1633:11: warning: Access to field 'chrs' results in a dereference of a null pointer (loaded from variable 'leads')
        for (p = leads->chrs, i = leads->nchrs; i > 0; p++, i--) {
                 ^~~~~~~~~~~
In file included from /private/tmp/kicad-PZ3oZb/wx/src/regex/regcomp.c:2176: /private/tmp/kicad-PZ3oZb/wx/src/regex/regc_color.c:472:22: warning: Result of 'malloc' is converted to a pointer of type 'union tree', which is incompatible with sizeof operand type 'struct ptrs'
                        t = (union tree *)MALLOC(sizeof(struct ptrs));
                             ~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/kicad-PZ3oZb/wx/src/regex/regguts.h:96:19: note: expanded from macro 'MALLOC'
#define MALLOC(n)       malloc(n)
                        ^~~~~~
In file included from /private/tmp/kicad-PZ3oZb/wx/src/regex/regcomp.c:2176: /private/tmp/kicad-PZ3oZb/wx/src/regex/regc_color.c:491:22: warning: Result of 'malloc' is converted to a pointer of type 'union tree', which is incompatible with sizeof operand type 'struct colors'
                        t = (union tree *)MALLOC(sizeof(struct colors));
                             ~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/kicad-PZ3oZb/wx/src/regex/regguts.h:96:19: note: expanded from macro 'MALLOC'
#define MALLOC(n)       malloc(n)
                        ^~~~~~
In file included from /private/tmp/kicad-PZ3oZb/wx/src/regex/regcomp.c:2177: /private/tmp/kicad-PZ3oZb/wx/src/regex/regc_nfa.c:374:15: warning: Access to field 'outchain' results in a dereference of a null pointer (loaded from variable 'a')
                a->outchain = victim->outchain;
                ~           ^
/private/tmp/kicad-PZ3oZb/wx/src/regex/regc_nfa.c:388:14: warning: Access to field 'inchain' results in a dereference of a null pointer (loaded from variable 'a')
                a->inchain = victim->inchain;
                ~          ^
/private/tmp/kicad-PZ3oZb/wx/src/regex/regc_nfa.c:1241:33: warning: Call to 'malloc' has an allocation size of 0 bytes cnfa->states = (struct carc **)MALLOC(nstates * sizeof(struct carc *));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/kicad-PZ3oZb/wx/src/regex/regguts.h:96:19: note: expanded from macro 'MALLOC'
#define MALLOC(n)       malloc(n)
                        ^~~~~~~~~
7 warnings generated.


_______________________________________________
Mailing list:https://launchpad.net/~kicad-developers  <https://launchpad.net/%7Ekicad-developers>
Post to     :kicad-developers@xxxxxxxxxxxxxxxxxxx  <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
Unsubscribe :https://launchpad.net/~kicad-developers  <https://launchpad.net/%7Ekicad-developers>
More help   :https://help.launchpad.net/ListHelp


_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


References