fix for string copy error in own recent commit
authorCampbell Barton <ideasman42@gmail.com>
Mon, 14 Feb 2011 01:31:44 +0000 (01:31 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 14 Feb 2011 01:31:44 +0000 (01:31 +0000)
source/blender/windowmanager/intern/wm_files.c

index 3187316..0bfbb15 100644 (file)
@@ -500,9 +500,7 @@ static void write_history(void)
                if (fp) {
                        /* add current file to the beginning of list */
                        recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
-                       recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(G.main->name)+1), "name of file");
-                       recent->filepath[0] = '\0';
-                       BLI_strncpy(recent->filepath, G.main->name, sizeof(recent->filepath));
+                       recent->filepath = BLI_strdup(G.main->name);
                        BLI_addhead(&(G.recent_files), recent);
                        /* write current file to recent-files.txt */
                        fprintf(fp, "%s\n", recent->filepath);