From: Ian Darwin Date: Tue, 8 Sep 1992 15:06:05 +0000 (+0000) Subject: Zoulos: fix bug that ran tryit() even if uncompress() failed. X-Git-Tag: FILE3_27~256 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6756ff884db0617d750704fcec9322144cb538f2;p=file Zoulos: fix bug that ran tryit() even if uncompress() failed. Uncomment out the free(newbuf) if uncompress succeeded. --- diff --git a/src/ascmagic.c b/src/ascmagic.c index a20d0e02..d7720744 100644 --- a/src/ascmagic.c +++ b/src/ascmagic.c @@ -29,16 +29,16 @@ #include #include #include +#include +#include #include "file.h" #include "names.h" #ifndef lint static char *moduleid = - "@(#)$Header: /home/glen/git/file/cvs/file/src/ascmagic.c,v 1.8 1992/05/22 17:48:38 ian Exp $"; + "@(#)$Header: /home/glen/git/file/cvs/file/src/ascmagic.c,v 1.9 1992/09/08 15:06:05 ian Exp $"; #endif /* lint */ -char *ckfmsg = "write error on output"; - /* an optimisation over plain strcmp() */ #define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) @@ -51,7 +51,6 @@ int nbytes; /* size actually read */ unsigned char *s; char *token; register struct names *p; - extern int zflag; /* these are easy, do them first */ @@ -103,9 +102,10 @@ int nbytes; /* size actually read */ unsigned char *newbuf; int newsize; - newsize = uncompress(buf, &newbuf, nbytes); - tryit(newbuf, newsize); - /* free(newbuf) */ + if (newsize = uncompress(buf, &newbuf, nbytes)) { + tryit(newbuf, newsize); + free(newbuf); + } printf(" (%scompressed data - %d bits)", isblock ? "block " : "", i); }