Module Name: src Committed By: christos Date: Fri Jun 28 14:49:14 UTC 2013
Modified Files: src/sys/fs/v7fs: v7fs_io.c Log Message: prevent memory leak on error http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/fs/v7fs/v7fs_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/fs/v7fs/v7fs_io.c diff -u src/sys/fs/v7fs/v7fs_io.c:1.2 src/sys/fs/v7fs/v7fs_io.c:1.3 --- src/sys/fs/v7fs/v7fs_io.c:1.2 Mon Jul 18 17:51:49 2011 +++ src/sys/fs/v7fs/v7fs_io.c Fri Jun 28 10:49:14 2013 @@ -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 @@ scratch_read(struct v7fs_self *fs, daddr 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;