diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2024-01-04 13:59:50 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2024-01-04 13:59:50 +0000 |
commit | 466361cb148e301213b8e8aa3b488bb4242827f2 (patch) | |
tree | a2d25eeca9e964ad9453d2c8fb97c3576f2c2045 /frontends/amiga | |
parent | c0904cf3fbc8078d162d509083f1ec2e0bdc2b18 (diff) | |
download | netsurf-466361cb148e301213b8e8aa3b488bb4242827f2.tar.gz netsurf-466361cb148e301213b8e8aa3b488bb4242827f2.tar.bz2 |
Amiga: Avoid double free of diskfont
Diffstat (limited to 'frontends/amiga')
-rw-r--r-- | frontends/amiga/font_diskfont.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/frontends/amiga/font_diskfont.c b/frontends/amiga/font_diskfont.c index a587d6eaf..be1b89194 100644 --- a/frontends/amiga/font_diskfont.c +++ b/frontends/amiga/font_diskfont.c @@ -100,7 +100,10 @@ static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_st tattr.ta_YSize = fstyle->size / PLOT_STYLE_SCALE; NSLOG(netsurf, INFO, "font: %s/%d", tattr.ta_Name, tattr.ta_YSize); - if(prev_font != NULL) CloseFont(prev_font); + if(prev_font != NULL) { + CloseFont(prev_font); + prev_font = NULL; + } if((bmfont = OpenDiskFont(&tattr))) { SetRPAttrs(rp, RPTAG_Font, bmfont, TAG_DONE); @@ -300,7 +303,14 @@ void ami_font_diskfont_init(void) void ami_font_diskfont_fini(void) { - if(prev_font != NULL) CloseFont(prev_font); - if(prev_fstyle != NULL) free(prev_fstyle); + if(prev_font != NULL) { + CloseFont(prev_font); + prev_font = NULL; + } + + if(prev_fstyle != NULL) { + free(prev_fstyle); + prev_fstyle = NULL; + } } |