Quick and dirty malloc() support for realpath.

Peter Kjellerstedt peter.kjellerstedt at axis.com
Wed Oct 28 08:57:01 UTC 2009


> -----Original Message-----
> From: uclibc-bounces at uclibc.org [mailto:uclibc-bounces at uclibc.org] On
> Behalf Of Mike Frysinger
> Sent: den 28 oktober 2009 09:02
> To: uclibc at uclibc.org
> Subject: Re: Quick and dirty malloc() support for realpath.

[ cut ]

> @@ -114,6 +114,8 @@ char got_path[];
>  		while (*path != '\0' && *path != '/') {
>  			if (new_path > max_path) {
>  				__set_errno(ENAMETOOLONG);
> + err:
> +				free(allocated_path);
>  				return NULL;

Fore readability, wouldn't it be better to put the three lines 
above at the end of the function, and just put another goto err 
here? Or is there some other reason to have the error exit path 
in the middle of the function?

//Peter


More information about the uClibc mailing list