On 15/10/2025 2:40 pm, Roger Pau Monne wrote:
> diff --git a/tools/libs/light/libxl_json.c b/tools/libs/light/libxl_json.c
> index c76ae9f64a9d..a9e06b06932d 100644
> --- a/tools/libs/light/libxl_json.c
> +++ b/tools/libs/light/libxl_json.c
> @@ -1366,11 +1366,13 @@ libxl__json_object *libxl__json_parse(libxl__gc *gc, 
> const char *s)
>      libxl__json_object *o = NULL;
>  #ifdef USE_LIBJSONC_PARSER
>      json_object *jso;
> -    enum json_tokener_error error;
> +    enum json_tokener_error error = json_tokener_success;

Looking at the options available, I'd suggest initialising to:

    json_tokener_error_parse_unexpected

and dropping the rest of the hunk.  I wouldn't assume that success
cannot be passed here.

~Andrew

>  
>      jso = json_tokener_parse_verbose(s, &error);
>      if (!jso) {
> -        LOG(ERROR, "json-c parse error: %s", json_tokener_error_desc(error));
> +        LOG(ERROR, "json-c parse error: %s",
> +            error != json_tokener_success ? json_tokener_error_desc(error)
> +                                          : "unspecified error");
>          goto out;
>      }
>  #endif


Reply via email to