File 1242-asn1-Fix-mismatched-allocation-function.patch of Package erlang

From 70294d783ada805f5e7f3cc8ca376d9a87f25f55 Mon Sep 17 00:00:00 2001
From: Frej Drejhammar <frej.drejhammar@gmail.com>
Date: Wed, 5 Apr 2023 15:37:59 +0200
Subject: [PATCH] asn1: Fix mismatched allocation function
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix bug with mismatched allocator/deallocator for
`enif_alloc`/`enif_free`. This error was detected as `enif_alloc` is
declared with the `malloc` attribute and recent GCCs complain that:
"‘free’ called on pointer returned from a mismatched allocation
function".
---
 lib/asn1/c_src/asn1_erl_nif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/asn1/c_src/asn1_erl_nif.c b/lib/asn1/c_src/asn1_erl_nif.c
index 8dc0dfedcf..aad9db5289 100644
--- a/lib/asn1/c_src/asn1_erl_nif.c
+++ b/lib/asn1/c_src/asn1_erl_nif.c
@@ -1167,7 +1167,7 @@ static mem_chunk_t *ber_new_chunk(unsigned int length) {
     new->next = NULL;
     new->top = enif_alloc(sizeof(char) * length);
     if (new->top == NULL) {
-	free(new);
+	enif_free(new);
 	return NULL;
     }
     new->curr = new->top + length - 1;
-- 
2.35.3

openSUSE Build Service is sponsored by