]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gensec: Fix an error path memleak in gensec_security_oids_from_ops()
authorVolker Lendecke <vl@samba.org>
Thu, 11 Jun 2026 11:56:33 +0000 (13:56 +0200)
committerAnoop C S <anoopcs@samba.org>
Wed, 17 Jun 2026 08:28:32 +0000 (08:28 +0000)
Probably irrelevant, mostly to please possible static checkers

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
auth/gensec/gensec_start.c

index 9f32c59bc878a8a0f276421677526db05fb90479..54928b82ced2fcc440908d91fd2ab81391dff85d 100644 (file)
@@ -541,13 +541,15 @@ static const char **gensec_security_oids_from_ops(
                }
 
                for (k = 0; ops[i]->oid[k]; k++) {
-                       oid_list = talloc_realloc(mem_ctx,
-                                                 oid_list,
-                                                 const char *,
-                                                 j + 2);
-                       if (!oid_list) {
+                       const char **tmp = talloc_realloc(mem_ctx,
+                                                         oid_list,
+                                                         const char *,
+                                                         j + 2);
+                       if (tmp == NULL) {
+                               TALLOC_FREE(oid_list);
                                return NULL;
                        }
+                       oid_list = tmp;
                        oid_list[j] = ops[i]->oid[k];
                        j++;
                }