Barry deFreese, le Mon 18 Jun 2012 00:20:17 -0400, a écrit :
> +#ifdef _GNU_SOURCE

_GNU_SOURCE is not something you can test. It's the application which is
supposed to define it. Test __GLIBC__ instead

> +        char *getcwd_buf= get_current_dir_name();
> +#else
>          char buf[PATH_MAX];
>          char *getcwd_buf= getcwd(buf, sizeof(buf));
> +#endif
>          throw libtest::fatal(LIBYATL_DEFAULT_PARAM,
>                               "Unable to open pidfile in %s for: %s 
> stderr:%s",
>                               getcwd_buf ? getcwd_buf : "",
>                               _running.c_str(),
>                               _app.stderr_c_str());
> +#ifdef _GNU_SOURCE
> +        free(getcwd_buf);
> +#endif

AIUI, the throw call is like "return", i.e. free will not be reached,
and thus getcwd_buf never freed. You can use strdupa to duplicate the
string into the stack, and then free the buffer returned by
get_current_dir_name before calling throw.

Samuel


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to