Fix T59900: duplicate font loading error and memory leak.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 27 Dec 2018 14:22:20 +0000 (15:22 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 27 Dec 2018 16:04:07 +0000 (17:04 +0100)
source/blender/blenkernel/intern/font.c

index e51b10a97a442183cbbf365a7ec8edbe79becfe1..6c716e58e237187290e81755663f2faab5e2a2d8 100644 (file)
@@ -244,7 +244,6 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
        char filename[FILE_MAXFILE];
        VFont *vfont = NULL;
        PackedFile *pf;
-       PackedFile *temp_pf = NULL;
        bool is_builtin;
 
        if (STREQ(filepath, FO_BUILTIN_NAME)) {
@@ -256,7 +255,6 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
        else {
                BLI_split_file_part(filepath, filename, sizeof(filename));
                pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain));
-               temp_pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain));
 
                is_builtin = false;
        }
@@ -282,7 +280,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
 
                        /* Do not add FO_BUILTIN_NAME to temporary listbase */
                        if (!STREQ(filename, FO_BUILTIN_NAME)) {
-                               vfont->temp_pf = temp_pf;
+                               vfont->temp_pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain));
                        }
                }