Re: [PATCH] libssl:Remove NULL checks before calling free()

2014-05-29 Thread Ted Unangst
On Fri, May 23, 2014 at 16:29, Brendan MacDonell wrote: > > I think this can be extended to expressions, not just identifiers: > > @@ > expression x; > @@ > -if (x) { free(x); } > +free(x); > > This catches another 47 instances. A patch against CVS follows. Thanks, applied.

Re: [PATCH] libssl:Remove NULL checks before calling free()

2014-05-23 Thread Cyril Roelandt
On 05/23/2014 09:29 PM, Brendan MacDonell wrote: > > I think this can be extended to expressions, not just identifiers: > > @@ > expression x; > @@ > -if (x) { free(x); } > +free(x); > Yes you are right. Shame on me. Regards, Cyril Roelandt.

Re: [PATCH] libssl:Remove NULL checks before calling free()

2014-05-23 Thread Brendan MacDonell
I think this can be extended to expressions, not just identifiers: @@ expression x; @@ -if (x) { free(x); } +free(x); This catches another 47 instances. A patch against CVS follows. diff -u -p a/src/apps/s_server.c b/src/apps/s_server.c --- a/src/apps/s_server.c +++ b/src/apps/s_serv

Re: [PATCH] libssl:Remove NULL checks before calling free()

2014-05-22 Thread Miod Vallat
> Hello, > > After reading > http://www.openbsd.org/papers/bsdcan14-libressl/mgp00015.html , I > thought I'd help a bit with cleaning libssl by running this > Coccinelle[1] script on src/lib/libssl: > > > @@ > identifier x; > @@ > -if (x) { free(x); } > +free(x); > > > It removes unnecessary N

[PATCH] libssl:Remove NULL checks before calling free()

2014-05-20 Thread Cyril Roelandt
Hello, After reading http://www.openbsd.org/papers/bsdcan14-libressl/mgp00015.html , I thought I'd help a bit with cleaning libssl by running this Coccinelle[1] script on src/lib/libssl: @@ identifier x; @@ -if (x) { free(x); } +free(x); It removes unnecessary NULL checks that happen before a