[hackers] [sbase] cut, uudecode: free buf after use || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Sun, 01 Jun 2014 19:01:36 +0200

commit daad071b31a94ac86d5dd501211fde8e6984e48c
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sun Jun 1 13:49:07 2014 +0200

    cut, uudecode: free buf after use
    
    Signed-off-by: Hiltjo Posthuma <hiltjo_AT_codemadness.org>

diff --git a/cut.c b/cut.c
index b058301..d21fcbe 100644
--- a/cut.c
+++ b/cut.c
_AT_@ -96,8 +96,8 @@ seek(const char *s, size_t pos, size_t *prev, size_t count)
 static void
 cut(FILE *fp)
 {
- static char *buf = NULL;
- static size_t size = 0;
+ char *buf = NULL;
+ size_t size = 0;
         char *s;
         size_t i, n, p;
         Range *r;
_AT_@ -123,6 +123,7 @@ cut(FILE *fp)
                 }
                 putchar('
');
         }
+ free(buf);
 }
 
 int
diff --git a/uudecode.c b/uudecode.c
index 9a40964..1196661 100644
--- a/uudecode.c
+++ b/uudecode.c
_AT_@ -173,4 +173,5 @@ uudecode(FILE *fp, FILE *outfp)
         afgets(&bufb, &n, fp);
         if (strnlen(bufb, 3) < 3 || strncmp(bufb, "end", 3) != 0 || bufb[3] != '
')
                 eprintf("invalid uudecode footer \"end\" not found
");
+ free(bufb);
 }
Received on Sun Jun 01 2014 - 19:01:36 CEST

This archive was generated by hypermail 2.3.0 : Sun Jun 01 2014 - 19:12:09 CEST