<tony.ngu...@bt.com> writes:

> Due to memory management rules. See HACKING.
>     
> Signed-off-by: Tony Nguyen <tony.ngu...@bt.com>
>
> diff --git a/tests/check-qjson.c b/tests/check-qjson.c
> index fa2afcc..07a773e 100644
> --- a/tests/check-qjson.c
> +++ b/tests/check-qjson.c
> @@ -767,7 +767,7 @@ static void utf8_string(void)
>                      if (*end == ' ') {
>                          end++;
>                      }
> -                    in = strndup(tail, end - tail);
> +                    in = g_strndup(tail, end - tail);
>                      str = from_json_str(in, j, NULL);
>                      g_assert(!str);
>                      g_free(in);

This one is fine.

> diff --git a/tests/migration/stress.c b/tests/migration/stress.c
> index 49a03aa..72c4012 100644
> --- a/tests/migration/stress.c
> +++ b/tests/migration/stress.c
> @@ -104,7 +104,7 @@ static int get_command_arg_str(const char *name,
>      }
>  
>      if (end)
> -        *val = strndup(start, end - start);
> +        *val = g_strndup(start, end - start);
>      else
>          *val = strdup(start);
>      return 1;

This one isn't.  The caller passes *val to free().  You have to change
*both* allocations in get_command_arg_str() *and* the deallocation in
get_command_arg_ull().

Reply via email to