[systemd-devel] [PATCH] make socket_instantiate_service use cleanup gcc attribute
Tom Gundersen
teg at jklm.no
Sat Jan 11 09:02:39 PST 2014
On Sat, Jan 11, 2014 at 4:20 PM, <misc at zarb.org> wrote:
> From: Michael Scherer <misc at zarb.org>
>
> ---
> src/core/socket.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/core/socket.c b/src/core/socket.c
> index 88599ca..1f2a2c0 100644
> --- a/src/core/socket.c
> +++ b/src/core/socket.c
> @@ -179,7 +179,8 @@ static int socket_arm_timer(Socket *s) {
> }
>
> static int socket_instantiate_service(Socket *s) {
> - char *prefix, *name;
> + _cleanup_free_ char *prefix = NULL;
> + _cleanup_free_ char *name = NULL;
> int r;
> Unit *u;
>
> @@ -199,13 +200,11 @@ static int socket_instantiate_service(Socket *s) {
> return -ENOMEM;
>
> r = asprintf(&name, "%s@%u.service", prefix, s->n_accepted);
> - free(prefix);
>
> if (r < 0)
> return -ENOMEM;
>
> r = manager_load_unit(UNIT(s)->manager, name, NULL, NULL, &u);
> - free(name);
>
> if (r < 0)
> return r;
> --
> 1.8.4.2
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Thanks. Applied.
Tom
More information about the systemd-devel
mailing list