From 9aa9b98e63a88c823ef7248f936fc39fd7e1d00a Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Mon, 6 Nov 2017 16:02:32 +0000 Subject: 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) --- src/mesa/main/extensions.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/mesa') 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); } } -- cgit v1.2.3