s3:util: Initialize json_object structures so we can call json_free()
authorAndreas Schneider <asn@samba.org>
Wed, 10 Aug 2022 06:41:24 +0000 (08:41 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 16 Aug 2022 18:27:13 +0000 (18:27 +0000)
CID 1507863
CID 1507865
CID 1507866
CID 1507867
CID 1507868
CID 1507869
CID 1507870

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15140

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15146
(cherry picked from commit 4a702cddaebf7e616706e0c728685567e141b493)

source3/utils/status_json.c

index e2798e3e392cca60505c2b3188bb9d3770008bdf..1f6357845413fff62aa212511ca7c3d4bbfef483 100644 (file)
@@ -189,7 +189,12 @@ int add_profile_item_to_json(struct traverse_state *state,
                             const char *key,
                             uintmax_t value)
 {
-       struct json_object section_json, subsection_json;
+       struct json_object section_json = {
+               .valid = false,
+       };
+       struct json_object subsection_json = {
+               .valid = false,
+       };
        int result = 0;
 
        section_json = json_get_object(&state->root_json, section);
@@ -796,8 +801,12 @@ static int add_open_to_json(struct json_object *parent_json,
                            uint32_t lease_type,
                            const char *uid_str)
 {
-       struct json_object sub_json;
-       struct json_object opens_json;
+       struct json_object sub_json = {
+               .valid = false,
+       };
+       struct json_object opens_json = {
+               .valid = false,
+       };
        struct timeval_buf tv_buf;
        int result = 0;
        char *timestr;
@@ -936,8 +945,12 @@ int print_share_mode_json(struct traverse_state *state,
                          uint32_t lease_type,
                          const char *filename)
 {
-       struct json_object locks_json;
-       struct json_object file_json;
+       struct json_object locks_json = {
+               .valid = false,
+       };
+       struct json_object file_json = {
+               .valid = false,
+       };
        char *key = NULL;
        int result = 0;
 
@@ -1013,8 +1026,12 @@ static int add_lock_to_json(struct json_object *parent_json,
                            intmax_t start,
                            intmax_t size)
 {
-       struct json_object sub_json;
-       struct json_object locks_json;
+       struct json_object sub_json = {
+               .valid = false,
+       };
+       struct json_object locks_json = {
+               .valid = false,
+       };
        const char *flavour_str;
        int result = 0;