the little operating system we wrote eventually panic'd (overflowed
heap);  standalone ufs.c implementation we've used leaks f_buf
everytime ufs_open fails

Index: ufs.c
===================================================================
RCS file: /cvs/src/sys/lib/libsa/ufs.c,v
retrieving revision 1.19
diff -u -r1.19 ufs.c
--- ufs.c       6 Jan 2008 11:17:18 -0000       1.19
+++ ufs.c       21 Aug 2010 19:24:12 -0000
@@ -527,6 +527,8 @@
        if (buf)
                free(buf, fs->fs_bsize);
        if (rc) {
+               if (fp->f_buf)
+                       free(fp->f_buf, fp->f_fs->fs_bsize);
                free(fp->f_fs, SBSIZE);
                free(fp, sizeof(struct file));
        }

Reply via email to