From: Shweta Sodani Date: Tue, 21 Apr 2026 12:03:29 +0000 (+0530) Subject: s3:winbind: fix response array leak on error paths X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3e6cda690b32a625a20441d0b0f82f5494c8487;p=thirdparty%2Fsamba.git s3:winbind: fix response array leak on error paths Free map_ids_out.ids unconditionally when it differs from map_ids_in.ids, not only on success. Signed-off-by: Shweta Sodani Reviewed-by: Pavel Filipenský Reviewed-by: Anoop C S Autobuild-User(master): Anoop C S Autobuild-Date(master): Sat May 9 11:51:32 UTC 2026 on atb-devel-224 --- diff --git a/source3/winbindd/wb_sids2xids.c b/source3/winbindd/wb_sids2xids.c index f5ff9223034..1473bbad7fd 100644 --- a/source3/winbindd/wb_sids2xids.c +++ b/source3/winbindd/wb_sids2xids.c @@ -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, };