]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4/ldap_backend: fix a NULL dereference
authorBjörn Jacke <bjacke@samba.org>
Mon, 25 Dec 2023 19:30:43 +0000 (20:30 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 29 Dec 2023 12:49:34 +0000 (12:49 +0000)
Signed-off-by: Bjoern Jacke <bjacke@samba.org>>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/ldap_server/ldap_backend.c

index 4e94417c21b46482543be490d1fdb95c45301f93..3bcd984f1498857f03f8eb3e9da58333fb07f3f3 100644 (file)
@@ -288,14 +288,15 @@ static NTSTATUS ldapsrv_encode(TALLOC_CTX *mem_ctx,
                                samba_ldap_control_handlers(),
                                &reply->blob,
                                mem_ctx);
-       TALLOC_FREE(reply->msg);
        if (!bret) {
                DEBUG(0,("Failed to encode ldap reply of type %d: "
                         "ldap_encode() failed\n",
                         reply->msg->type));
+               TALLOC_FREE(reply->msg);
                return NT_STATUS_NO_MEMORY;
        }
 
+       TALLOC_FREE(reply->msg);
        talloc_set_name_const(reply->blob.data,
                              "Outgoing, encoded single LDAP reply");