]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:kdc: Free target principal string to avoid memory leak (CID 1596760)
authorJo Sutton <josutton@catalyst.net.nz>
Mon, 6 May 2024 00:19:18 +0000 (12:19 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 16 May 2024 02:11:37 +0000 (02:11 +0000)
Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/kdc/kpasswd-service-heimdal.c

index d661548b541928bf2ca386d64207ba7baf6e55a7..b9be30fb8ff639b771a89a897423155a48eb6f46 100644 (file)
@@ -213,6 +213,7 @@ static krb5_error_code kpasswd_set_password(struct kdc_server *kdc,
                                              "Failed to parse principal",
                                              kpasswd_reply);
                if (!ok) {
+                       krb5_xfree(target_principal_string);
                        *error_string = "Failed to create reply";
                        return KRB5_KPASSWD_HARDERROR;
                }
@@ -227,6 +228,7 @@ static krb5_error_code kpasswd_set_password(struct kdc_server *kdc,
                                            &password,
                                            &reject_reason,
                                            &dominfo);
+       krb5_xfree(target_principal_string);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_ERR("kpasswd_samdb_set_password failed - %s\n",
                        nt_errstr(status));