diff options
author | dg <dg@FreeBSD.org> | 1995-01-09 05:59:04 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-01-09 05:59:04 +0000 |
commit | 8441e720c7e936ff93a9597309ec8312a4b15fe8 (patch) | |
tree | 33b7e494eaa588dcd85ae331639692844d0075c7 /usr.bin | |
parent | 4969834bb25d688c299d10843d4c8f7cb2b61e29 (diff) | |
download | FreeBSD-src-8441e720c7e936ff93a9597309ec8312a4b15fe8.zip FreeBSD-src-8441e720c7e936ff93a9597309ec8312a4b15fe8.tar.gz |
Fixed two bugs: some malloced space wasn't freed after it was no longer
needed and the file wasn't closed when the -t option was used.
Originally by thomas@mathematik.uni-Bremen.de, but were incomplete.
Submitted by: thomas@mathematik.uni-Bremen.de and myself
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ranlib/build.c | 9 | ||||
-rw-r--r-- | usr.bin/ranlib/touch.c | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/ranlib/build.c b/usr.bin/ranlib/build.c index 12a6dc6..ff745be 100644 --- a/usr.bin/ranlib/build.c +++ b/usr.bin/ranlib/build.c @@ -220,7 +220,7 @@ bad1: (void)lseek(rfd, r_off, SEEK_SET); static void symobj() { - register RLIB *rp; + register RLIB *rp, *rpnext; struct ranlib rn; off_t ransize; long size, stroff; @@ -272,9 +272,14 @@ symobj() error(tname); /* Write out the string table. */ - for (rp = rhead; rp; rp = rp->next) + for (rp = rhead; rp; rp = rpnext) { if (!fwrite(rp->sym, rp->symlen, 1, fp)) error(tname); + rpnext = rp->next; + free(rp->sym); + free(rp); + } + rhead = NULL; if (pad && !fwrite(&pad, sizeof(pad), 1, fp)) error(tname); diff --git a/usr.bin/ranlib/touch.c b/usr.bin/ranlib/touch.c index 4cf4b12..0dd9123 100644 --- a/usr.bin/ranlib/touch.c +++ b/usr.bin/ranlib/touch.c @@ -65,6 +65,7 @@ touch() return(1); } settime(afd); + close_archive(afd); return(0); } |