Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/v7fs prevent memory leak on error



details:   https://anonhg.NetBSD.org/src/rev/15bd4b023e42
branches:  trunk
changeset: 787689:15bd4b023e42
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jun 28 14:49:14 2013 +0000

description:
prevent memory leak on error
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html

diffstat:

 sys/fs/v7fs/v7fs_io.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 0e5633c328bf -r 15bd4b023e42 sys/fs/v7fs/v7fs_io.c
--- a/sys/fs/v7fs/v7fs_io.c     Fri Jun 28 14:48:17 2013 +0000
+++ b/sys/fs/v7fs/v7fs_io.c     Fri Jun 28 14:49:14 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: v7fs_io.c,v 1.2 2011/07/18 21:51:49 apb Exp $  */
+/*     $NetBSD: v7fs_io.c,v 1.3 2013/06/28 14:49:14 christos Exp $     */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: v7fs_io.c,v 1.2 2011/07/18 21:51:49 apb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: v7fs_io.c,v 1.3 2013/06/28 14:49:14 christos Exp $");
 #if defined _KERNEL_OPT
 #include "opt_v7fs.h"
 #endif
@@ -96,6 +96,7 @@
        uint8_t *buf = malloc(V7FS_BSIZE);
        if (!fs->io.read(fs->io.cookie, buf, blk)) {
                DPRINTF("*** I/O error block %ld\n",(long)blk);
+               free(buf);
                return NULL;
        }
        return buf;



Home | Main Index | Thread Index | Old Index