[systemd-devel] [PATCH] libsystemd-network: avoid double-free in error case

Tom Gundersen teg at jklm.no
Tue Sep 16 07:20:17 PDT 2014


Applied. Thanks!

On Tue, Sep 16, 2014 at 3:50 PM, Andreas Henriksson <andreas at fatal.se> wrote:
> Don't manually free 'n' in error path as it's already tagged
> _cleanup_free_ and will be freed once it goes out of scope,
> leading to double-free in this case.
>
> Found with coverity. Fixes: CID#1237786
>
> Signed-off-by: Andreas Henriksson <andreas at fatal.se>

We don't do s-o-b, so I dropped this line.

Cheers,

Tom

>  src/libsystemd-network/network-internal.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c
> index 208c314..372f3ed 100644
> --- a/src/libsystemd-network/network-internal.c
> +++ b/src/libsystemd-network/network-internal.c
> @@ -199,7 +199,6 @@ int config_parse_ifname(const char *unit,
>          if (!ascii_is_valid(n) || strlen(n) >= IFNAMSIZ) {
>                  log_syntax(unit, LOG_ERR, filename, line, EINVAL,
>                             "Interface name is not ASCII clean or is too long, ignoring assignment: %s", rvalue);
> -                free(n);
>                  return 0;
>          }
>
> --
> 2.1.0
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list