diff options
author | Thomas White <taw@bitwiz.org.uk> | 2011-11-06 23:37:14 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2011-11-06 23:37:14 +0100 |
commit | 3a4ffdc0c15e7ca844eeabdb1489de54146d408d (patch) | |
tree | 14e38c2108856d361d31ba13a7879033da28b5c6 /src/loadsave.c | |
parent | 99088702058e5c1951901c64fc433703db68cd09 (diff) |
Fiddle filename pointers
Diffstat (limited to 'src/loadsave.c')
-rw-r--r-- | src/loadsave.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/loadsave.c b/src/loadsave.c index e6a03ff..79ecc20 100644 --- a/src/loadsave.c +++ b/src/loadsave.c @@ -751,6 +751,7 @@ int save_presentation(struct presentation *p, const char *filename) FILE *fh; int i; struct serializer ser; + char *old_fn; fh = fopen(filename, "w"); if ( fh == NULL ) return 1; @@ -802,8 +803,11 @@ int save_presentation(struct presentation *p, const char *filename) } serialize_end(&ser); - if ( p->filename != NULL ) free(p->filename); + /* Slightly fiddly because someone might + * do save_presentation(p, p->filename) */ + old_fn = p->filename; p->filename = strdup(filename); + if ( old_fn != NULL ) free(old_fn); update_titlebar(p); fclose(fh); |