On 18/04/16 13:30, Emil Velikov wrote:
On 18 April 2016 at 10:14, Jose Fonseca <[email protected]> wrote:@@ -306,6 +309,15 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name, if (!gallivm->context) goto fail; + gallivm->module_name = NULL; + if (name) { + size_t size = strlen(name) + 1; + gallivm->module_name = MALLOC(size); + if (gallivm->module_name) { + memcpy(gallivm->module_name, name, size);Since we already use stdup in gallium/aux one could do the same here.
We shouldn't be using strdup in gallium/auxiliary. The ability of embedded gallium and keep track of its memory allocations it's important.
There's only one instance where inappropriate use of strdup crept in gallium (u_debug_symbol.c). But that's should be taken as a bug (not as precedent to imitate).
In fact, nobody that cares for Vulkan should be using strdup outside of GL specific components at all -- see https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#memory-host --, use malloc/free/strdup/etc should be eliminated all together. but I'll let others to worry about that.
Jose _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
