GCC warnings while compiling OTP-25.2.3 on Ubuntu 22.04


how serious are these compiler warnings below?

17:09:10   CC	../priv/obj/x86_64-pc-linux-gnu/asn1_erl_nif.o
17:09:10  In function 'ber_new_chunk',
17:09:10      inlined from 'ber_check_memory' at asn1_erl_nif.c:1193:16:
17:09:10  asn1_erl_nif.c:1170:9: warning: 'free' called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
17:09:10   1170 |         free(new);
17:09:10        |         ^~~~~~~~~
17:09:10  asn1_erl_nif.c: In function 'ber_check_memory':
17:09:10  asn1_erl_nif.c:1164:24: note: returned from 'enif_alloc'
17:09:10   1164 |     mem_chunk_t *new = enif_alloc(sizeof(mem_chunk_t));
17:09:10        |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Shouldn’t “mismatched-dealloc” option be turned off for the asn1 files if it is not used?
It looks like there are only specific memory allocators for the asn1 encoding/decoding but no de-allocators and gcc gets confused…

As the gcc man page (on Ubuntu 22.04) says:

“Option -Wmismatched-dealloc is enabled by default.”

… maybe the code above should be compiled using: “-Wno-mismatched-dealloc” ??


Not harmful but fixed in OTP

  OTP-18844    Application(s): asn1

           Fix benign warning from gcc 11 about mismatching call
           to free().