Hi,
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” ??
Thanks.