DRW: Fix Memory leak introduced by previous commit
authorClément Foucault <foucault.clem@gmail.com>
Thu, 28 Mar 2019 17:09:10 +0000 (18:09 +0100)
committerClément Foucault <foucault.clem@gmail.com>
Thu, 28 Mar 2019 21:08:54 +0000 (22:08 +0100)
source/blender/draw/intern/draw_cache_impl_mesh.c

index bc5c4f8aeb0610592027901e361390bc7be8b135..ddb36c62682000ffe3d7a89741909bbab93d2f58 100644 (file)
@@ -587,6 +587,10 @@ static void mesh_cd_extract_auto_layers_names_and_srgb(
        auto_names = MEM_reallocN(auto_names, sizeof(char) * auto_ofs);
        auto_is_srgb = MEM_reallocN(auto_is_srgb, sizeof(int) * auto_is_srgb_ofs);
 
+       /* WATCH: May have been referenced somewhere before freeing. */
+       MEM_SAFE_FREE(*r_auto_layers_names);
+       MEM_SAFE_FREE(*r_auto_layers_srgb);
+
        *r_auto_layers_names = auto_names;
        *r_auto_layers_srgb = auto_is_srgb;
        *r_auto_layers_len = auto_is_srgb_ofs;