diff options
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); } |