summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2017-11-06 16:02:32 +0000
committerEmil Velikov <[email protected]>2017-11-16 14:08:03 +0000
commit9aa9b98e63a88c823ef7248f936fc39fd7e1d00a (patch)
treee87f823fc20bcee7437ce1eba0c1fb9d230452d9
parent3d81e11b49366b5636b8524ba0f8c7076e3fdf34 (diff)
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 <[email protected]> Reviewed-by: Brian Paul <[email protected]> (v1)
-rw-r--r--src/mesa/main/extensions.c4
1 files changed, 1 insertions, 3 deletions
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);
}
}