diff options
author | Xiao-Yong Jin <xjin@anl.gov> | 2018-03-20 22:15:12 -0500 |
---|---|---|
committer | David du Colombier <0intro@gmail.com> | 2018-03-27 15:03:12 +0200 |
commit | 7ca1c90109e17dced4b38fbaadea9d2cf39871b7 (patch) | |
tree | 7a47477e3525e2a77ba36e61293a90df64cf316e /src/cmd/acme | |
parent | 96dc2330918909c925a5c3a6407116dad7f93c3a (diff) | |
download | plan9port-7ca1c90109e17dced4b38fbaadea9d2cf39871b7.tar.gz plan9port-7ca1c90109e17dced4b38fbaadea9d2cf39871b7.tar.bz2 plan9port-7ca1c90109e17dced4b38fbaadea9d2cf39871b7.zip |
acme: fix some memory leaks
Diffstat (limited to 'src/cmd/acme')
-rw-r--r-- | src/cmd/acme/acme.c | 7 | ||||
-rw-r--r-- | src/cmd/acme/exec.c | 1 | ||||
-rw-r--r-- | src/cmd/acme/rows.c | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/cmd/acme/acme.c b/src/cmd/acme/acme.c index 10dcdcc8..742aabdf 100644 --- a/src/cmd/acme/acme.c +++ b/src/cmd/acme/acme.c @@ -383,7 +383,7 @@ int erroutfd; void acmeerrorproc(void *v) { - char *buf; + char *buf, *s; int n; USED(v); @@ -391,8 +391,11 @@ acmeerrorproc(void *v) buf = emalloc(8192+1); while((n=read(errorfd, buf, 8192)) >= 0){ buf[n] = '\0'; - sendp(cerr, estrdup(buf)); + s = estrdup(buf); + sendp(cerr, s); + free(s); } + free(buf); } void diff --git a/src/cmd/acme/exec.c b/src/cmd/acme/exec.c index deaef0cb..68c5d976 100644 --- a/src/cmd/acme/exec.c +++ b/src/cmd/acme/exec.c @@ -194,6 +194,7 @@ execute(Text *t, uint aq0, uint aq1, int external, Text *argt) aa = getbytearg(argt, TRUE, TRUE, &a); if(a){ if(strlen(a) > EVENTSIZE){ /* too big; too bad */ + free(r); free(aa); free(a); warning(nil, "argument string too long\n"); diff --git a/src/cmd/acme/rows.c b/src/cmd/acme/rows.c index 2d6cbcca..8cff0855 100644 --- a/src/cmd/acme/rows.c +++ b/src/cmd/acme/rows.c @@ -613,6 +613,7 @@ rowload(Row *row, char *file, int initing) } textdelete(&row->col[i]->tag, 0, row->col[i]->tag.file->b.nc, TRUE); textinsert(&row->col[i]->tag, 0, r+n+1, nr-(n+1), TRUE); + free(r); break; case 'w': l[Blinelen(b)-1] = 0; @@ -626,6 +627,7 @@ rowload(Row *row, char *file, int initing) } textdelete(&row->tag, 0, row->tag.file->b.nc, TRUE); textinsert(&row->tag, 0, r, nr, TRUE); + free(r); break; default: done = 1; |