[PATCH 1/3] mkfs/proto.c: avoid to use NULL pointer

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

 



Change malloc to xmalloc.

Signed-off-by: zhanchengbin <zhanchengbin1@xxxxxxxxxx>
---
 mkfs/proto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mkfs/proto.c b/mkfs/proto.c
index 127d87dd..f3b8710c 100644
--- a/mkfs/proto.c
+++ b/mkfs/proto.c
@@ -70,7 +70,7 @@ setup_proto(
 		goto out_fail;
 	}

-	buf = malloc(size + 1);
+	buf = xmalloc(size + 1);
 	if (read(fd, buf, size) < size) {
 		fprintf(stderr, _("%s: read failed on %s: %s\n"),
 			progname, fname, strerror(errno));
@@ -303,7 +303,7 @@ newregfile(
 		exit(1);
 	}
 	if ((*len = (int)size)) {
-		buf = malloc(size);
+		buf = xmalloc(size);
 		if (read(fd, buf, size) < size) {
 			fprintf(stderr, _("%s: read failed on %s: %s\n"),
 				progname, fname, strerror(errno));
--
2.27.0



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux