head 1.1; access; symbols; locks; strict; comment @ * @; 1.1 date 2026.11.30.09.08.28; author wiz; state Exp; branches; next ; commitid uerpYkcG24mjRs5H; desc @@ 1.1 log @mesa: carry over atexit() patches from MesaLib, simplified Fixes coredumps on exit. Reported upstream, let's see what happens. XXX: there are a couple more atexit() locations remaining that might need patching as well. Bump PKGREVISION. @ text @$NetBSD$ avoid atexit in shared libraries. https://gitlab.freedesktop.org/mesa/mesa/-/work_items/17072 --- src/util/u_process.c.orig 2026-11-30 08:51:00.045687862 +0000 +++ src/util/u_process.c @@@@ -194,10 +194,11 @@@@ static char *program_name; static char *program_name; -static void +static void __attribute__((__destructor__)) free_program_name(void) { - free(program_name); + if (program_name) + free(program_name); program_name = NULL; } @@@@ -206,9 +207,6 @@@@ util_get_process_name_callback(void) { const char *override_name = os_get_option("MESA_PROCESS_NAME"); program_name = override_name ? strdup(override_name) : __getProgramName(); - - if (program_name) - atexit(free_program_name); } const char * @