]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Fix an error path memleak
authorVolker Lendecke <vl@samba.org>
Thu, 23 May 2024 14:12:53 +0000 (16:12 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 4 Jun 2024 07:11:35 +0000 (07:11 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/util/asn1.c

index 52b91b51d0004eaeabbe40b682f236172697332b..4ce85e9b0d9fca4693ce82e64862a58eb6f09788 100644 (file)
@@ -308,8 +308,11 @@ bool ber_write_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *OID)
                v = smb_strtoul(p, &newp, 10, &error, SMB_STR_STANDARD);
                if (newp[0] == '.' || error != 0) {
                        p = newp + 1;
-                       /* check for empty last component */
-                       if (!*p) return false;
+                       if (!*p) {
+                               /* empty last component */
+                               data_blob_free(blob);
+                               return false;
+                       }
                } else if (newp[0] == '\0') {
                        p = newp;
                } else {