From: Emil Velikov Date: Mon, 6 Nov 2017 16:02:32 +0000 (+0000) Subject: mesa: call atexit() only as needed X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9aa9b98e63a88c823ef7248f936fc39fd7e1d00a;p=mesa.git mesa: call atexit() only as needed If the extra_extensions string is empty there's no need to call atexit() - there's nothing to free. v2: Rebase Signed-off-by: Emil Velikov Reviewed-by: Brian Paul (v1) --- diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 7483b8f2496..be3970c6393 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -245,8 +245,6 @@ _mesa_one_time_init_extension_overrides(void) int len; size_t offset; - atexit(free_unknown_extensions_strings); - memset(&_mesa_extension_override_enables, 0, sizeof(struct gl_extensions)); memset(&_mesa_extension_override_disables, 0, sizeof(struct gl_extensions)); @@ -305,9 +303,9 @@ _mesa_one_time_init_extension_overrides(void) len = strlen(extra_extensions); if (len == 0) { free(extra_extensions); - extra_extensions = NULL; } else if (extra_extensions[len - 1] == ' ') { extra_extensions[len - 1] = '\0'; + atexit(free_unknown_extensions_strings); } }