* Axton <[EMAIL PROTECTED]> [2007-05-26 02:08]:
> In parse.y for OpenBSD's ntpd, would/could this result in a double free:
>
> number : STRING {
> u_long ulval;
> const char *errstr;
>
> ulval = strtonum($1, 0, INT_MAX, &errstr);
> if (errstr) {
> yyerror("\"%s\" invalid: %s", $1, errstr);
> free($1);
> YYERROR;
> } else
> $$ = ulval;
> free($1);
> }
> ;
>
> From
> http://www.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/ntpd/parse.y?rev=1.30&content-type=text/x-cvsweb-markup
>
> The if statement will free($1) if it is not a valid u_long, then at
> the end of the block, there is a subsequent free($1).
no, YYERROR terminates
--
Henning Brauer, [EMAIL PROTECTED], [EMAIL PROTECTED]
BS Web Services, http://bsws.de
Full-Service ISP - Secure Hosting, Mail and DNS Services
Dedicated Servers, Rootservers, Application Hosting - Hamburg & Amsterdam