aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/fontsrv
diff options
context:
space:
mode:
authorXiao-Yong Jin <xjin@anl.gov>2018-03-20 22:17:05 -0500
committerDavid du Colombier <0intro@gmail.com>2018-03-27 15:03:12 +0200
commita3ec102dc7fee3d4ecb32ade5ec9d7de4b9b4304 (patch)
tree1a5be8c73d48ab0da5a8a4d892575248ccf6455d /src/cmd/fontsrv
parentb2f67698309b0c573cd52e357be126171be0a93a (diff)
downloadplan9port-a3ec102dc7fee3d4ecb32ade5ec9d7de4b9b4304.tar.gz
plan9port-a3ec102dc7fee3d4ecb32ade5ec9d7de4b9b4304.tar.bz2
plan9port-a3ec102dc7fee3d4ecb32ade5ec9d7de4b9b4304.zip
fontsrv: fix some memory leaks
Diffstat (limited to 'src/cmd/fontsrv')
-rw-r--r--src/cmd/fontsrv/osx.c4
-rw-r--r--src/cmd/fontsrv/x11.c1
2 files changed, 4 insertions, 1 deletions
diff --git a/src/cmd/fontsrv/osx.c b/src/cmd/fontsrv/osx.c
index 18197a23..4d969290 100644
--- a/src/cmd/fontsrv/osx.c
+++ b/src/cmd/fontsrv/osx.c
@@ -245,8 +245,10 @@ mksubfont(XFont *f, char *name, int lo, int hi, int size, int antialias)
if(m == nil)
return nil;
mc = allocmemimage(Rect(0, 0, x+1, y+1), GREY8);
- if(mc == nil)
+ if(mc == nil){
+ freememimage(m);
return nil;
+ }
memfillcolor(m, DBlack);
memfillcolor(mc, DBlack);
fc = malloc((hi+2 - lo) * sizeof fc[0]);
diff --git a/src/cmd/fontsrv/x11.c b/src/cmd/fontsrv/x11.c
index f106d253..a097ca4d 100644
--- a/src/cmd/fontsrv/x11.c
+++ b/src/cmd/fontsrv/x11.c
@@ -236,6 +236,7 @@ mksubfont(XFont *xf, char *name, int lo, int hi, int size, int antialias)
m1 = allocmemimage(Rect(0, 0, x, y), antialias ? GREY8 : GREY1);
memimagedraw(m1, m1->r, m, m->r.min, memopaque, ZP, S);
freememimage(m);
+ freememimage(mc);
sf->name = nil;
sf->n = hi+1 - lo;