s3:utils: Check return value of json_new_object()
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 22 May 2023 23:16:56 +0000 (11:16 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 24 May 2023 00:50:31 +0000 (00:50 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/utils/status.c

index 5359dda90cc0e4f93f798093a12e702149b4e549..cbdb0de67ede3acf918c3eace807e86ee24069a7 100644 (file)
@@ -1078,7 +1078,9 @@ int main(int argc, const char *argv[])
 
 #ifdef HAVE_JANSSON
        state.root_json = json_new_object();
-       add_general_information_to_json(&state);
+       if (!json_is_invalid(&state.root_json)) {
+               add_general_information_to_json(&state);
+       }
 #else /* HAVE_JANSSON */
        if (state.json_output) {
                fprintf(stderr, "JSON support not available, please install lib Jansson\n");