On Wed, Nov 29, 2017 at 1:25 AM huanglili <[email protected]>
wrote:

> From: Lili Huang <[email protected]>
>
> OVS_COLORS variable color_str is parsed by using xstrdup and strsep,
> we should free original address of the string, not used after strsep.
>
> Change-Id: I8ea735b10149f657137937bbd9c883d22bf85d4a
> Signed-off-by: Lili Huang <[email protected]>
>

Acked-by: Mark Michelson <[email protected]>


> ---
>  lib/colors.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/colors.c b/lib/colors.c
> index 4ea1880..1345644 100644
> --- a/lib/colors.c
> +++ b/lib/colors.c
> @@ -112,6 +112,7 @@ colors_parse_from_env(const struct color_key
> color_dic[])
>
>      /* Loop on tokens: they are separated by columns ':' */
>      char *s = xstrdup(color_str);
> +    char *s_head = s;
>      for (char *token = strsep(&s, ":");
>           token != NULL;
>           token = strsep(&s, ":")) {
> @@ -134,5 +135,5 @@ colors_parse_from_env(const struct color_key
> color_dic[])
>              }
>          }
>      }
> -    free(s);
> +    free(s_head);
>  }
> --
> 1.9.5.msysgit.1
>
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to