Source-Changes-HG archive

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

[src/trunk]: src/sbin/newfs_udf PR/50920: David Binderman: fix leak



details:   https://anonhg.NetBSD.org/src/rev/f7d51f817d2e
branches:  trunk
changeset: 344011:f7d51f817d2e
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Mar 09 19:48:24 2016 +0000

description:
PR/50920: David Binderman: fix leak

diffstat:

 sbin/newfs_udf/newfs_udf.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (26 lines):

diff -r 29af3141ebf2 -r f7d51f817d2e sbin/newfs_udf/newfs_udf.c
--- a/sbin/newfs_udf/newfs_udf.c        Wed Mar 09 19:47:13 2016 +0000
+++ b/sbin/newfs_udf/newfs_udf.c        Wed Mar 09 19:48:24 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: newfs_udf.c,v 1.18 2013/08/09 15:11:08 reinoud Exp $ */
+/* $NetBSD: newfs_udf.c,v 1.19 2016/03/09 19:48:24 christos Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013 Reinoud Zandijk
@@ -121,11 +121,13 @@
        if ((seekpos == NULL) || (seekpos->sectornr != location)) {
                pos = calloc(1, sizeof(struct wrsect));
                if (pos == NULL)
-                       return ENOMEM;
+                       return errno;
                /* allocate space for copy of sector data */
                pos->sector_data = calloc(1, context.sector_size);
-               if (pos->sector_data == NULL)
-                       return ENOMEM;
+               if (pos->sector_data == NULL) {
+                       free(pos);
+                       return errno;
+               }
                pos->sectornr = location;
 
                if (seekpos) {



Home | Main Index | Thread Index | Old Index