Module Name: src
Committed By: christos
Date: Wed Mar 9 19:48:24 UTC 2016
Modified Files:
src/sbin/newfs_udf: newfs_udf.c
Log Message:
PR/50920: David Binderman: fix leak
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sbin/newfs_udf/newfs_udf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/newfs_udf/newfs_udf.c
diff -u src/sbin/newfs_udf/newfs_udf.c:1.18 src/sbin/newfs_udf/newfs_udf.c:1.19
--- src/sbin/newfs_udf/newfs_udf.c:1.18 Fri Aug 9 11:11:08 2013
+++ src/sbin/newfs_udf/newfs_udf.c Wed Mar 9 14:48:24 2016
@@ -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 @@ udf_write_sector(void *sector, uint64_t
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) {