]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
dsdb: Avoid a talloc
authorVolker Lendecke <vl@samba.org>
Mon, 13 Jan 2025 09:07:46 +0000 (10:07 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 23 Jan 2025 23:08:38 +0000 (23:08 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/dsdb/samdb/ldb_modules/samba3sam.c

index ebf25ac92b66aa8ed5e648defa80beef1cdc781a..c655d5551bb275dd3c66cf90259724f16dee7164 100644 (file)
@@ -183,17 +183,19 @@ static struct ldb_val lookup_uid(struct ldb_module *module, TALLOC_CTX *ctx, con
 static struct ldb_val encode_sid(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val)
 {
        struct ldb_val out = data_blob(NULL, 0);
-       struct dom_sid *sid;
+       struct dom_sid sid = {};
        enum ndr_err_code ndr_err;
+       bool ok;
 
-       sid = dom_sid_parse_talloc(ctx, (char *)val->data);
-       if (sid == NULL) {
+       ok = dom_sid_parse((char *)val->data, &sid);
+       if (!ok) {
                return out;
        }
 
-       ndr_err = ndr_push_struct_blob(&out, ctx, 
-                                      sid, (ndr_push_flags_fn_t)ndr_push_dom_sid);
-       talloc_free(sid);
+       ndr_err = ndr_push_struct_blob(&out,
+                                      ctx,
+                                      &sid,
+                                      (ndr_push_flags_fn_t)ndr_push_dom_sid);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                return out;
        }