]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:winbind: fix response array leak on error paths
authorShweta Sodani <ssodani@redhat.com>
Tue, 21 Apr 2026 12:03:29 +0000 (17:33 +0530)
committerAnoop C S <anoopcs@samba.org>
Sat, 9 May 2026 11:51:32 +0000 (11:51 +0000)
Free map_ids_out.ids unconditionally when it differs from
map_ids_in.ids, not only on success.

Signed-off-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Sat May  9 11:51:32 UTC 2026 on atb-devel-224

source3/winbindd/wb_sids2xids.c

index f5ff9223034fafb8e6d59ad158ae6894b80bf940..1473bbad7fd183bc9a6ff345d71f18bf28bbd488 100644 (file)
@@ -702,13 +702,11 @@ static void wb_sids2xids_done(struct tevent_req *subreq)
        }
 
        state->map_ids_in.num_ids = 0;
-       if (NT_STATUS_IS_OK(status)) {
-               /*
-                * If we got a valid response, we expect
-                * state->map_ids_out.ids to be a new allocated
-                * array, which we want to free early.
-                */
-               SMB_ASSERT(state->map_ids_out.ids != state->map_ids_in.ids);
+       /*
+        * If state->map_ids_out.ids is a newly allocated
+        * array, we want to free it early.
+        */
+       if (state->map_ids_out.ids != state->map_ids_in.ids) {
                TALLOC_FREE(state->map_ids_out.ids);
        }
        state->map_ids_out = (struct wbint_TransIDArray) { .num_ids = 0, };