[systemd-devel] [PATCH 3/3] shared: free dt (temporary dir name) on fail

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Mar 27 09:07:46 PDT 2013


On Wed, Mar 27, 2013 at 03:16:37PM +0100, Vaclav Pavlin wrote:
> From: Václav Pavlín <vpavlin at redhat.com>
> 
> ---
>  src/shared/util.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/shared/util.c b/src/shared/util.c
> index 0444cf4..b724959 100644
> --- a/src/shared/util.c
> +++ b/src/shared/util.c
> @@ -5733,6 +5733,7 @@ int create_tmp_dir(char template[], char** dir_name) {
>          return 0;
>  fail1:
>          rmdir(dt);
> +        free(dt);
>  fail2:
>          rmdir(template);
>          return r;
Applied this one with a tweak to not call rmdir() unless mkdir() succeeded.

Zbyszek


More information about the systemd-devel mailing list