]> granicus.if.org Git - file/commitdiff
Zoulos: fix bug that ran tryit() even if uncompress() failed.
authorIan Darwin <ian@darwinsys.com>
Tue, 8 Sep 1992 15:06:05 +0000 (15:06 +0000)
committerIan Darwin <ian@darwinsys.com>
Tue, 8 Sep 1992 15:06:05 +0000 (15:06 +0000)
Uncomment out the free(newbuf) if uncompress succeeded.

src/ascmagic.c

index a20d0e02347ea2f4cbbe7b377949a68f3d4d8267..d7720744c8ad570c30751f2b673bef050fa22dca 100644 (file)
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
 #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);
                }