tmore memory errors (valgrind) - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit 40402738daf5ef541ffa358c17c5afc69a9d0c5e
parent 96f54e3fff8967000ed5bd5bd4501e47d194045d
Author: rsc 
Date:   Mon, 26 Mar 2007 15:02:15 +0000

more memory errors (valgrind)

Diffstat:
  M src/cmd/rc/code.c                   |       1 +
  M src/cmd/rc/io.c                     |       2 +-
  M src/cmd/rc/subr.c                   |       1 +

3 files changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/cmd/rc/code.c b/src/cmd/rc/code.c
t@@ -26,6 +26,7 @@ morecode(void)
         if(codebuf==0)
                 panic("Can't realloc %d bytes in morecode!",
                                 ncode*sizeof codebuf[0]);
+        memset(codebuf+ncode-100, 0, 100*sizeof codebuf[0]);
         return 0;
 }
 
diff --git a/src/cmd/rc/io.c b/src/cmd/rc/io.c
t@@ -37,7 +37,7 @@ pfmt(io *f, char *fmt, ...)
                         pwrd(f, va_arg(ap, char *));
                         break;
                 case 'r':
-                        errstr(err, sizeof err); pstr(f, err);
+                        rerrstr(err, sizeof err); pstr(f, err);
                         break;
                 case 's':
                         pstr(f, va_arg(ap, char *));
diff --git a/src/cmd/rc/subr.c b/src/cmd/rc/subr.c
t@@ -10,6 +10,7 @@ emalloc(long n)
         if(p==0)
                 panic("Can't malloc %d bytes", n);
 /*        if(err){ pfmt(err, "malloc %d->%p\n", n, p); flush(err); } /**/
+        memset(p, 0, n);
         return p;
 }