shithub: hx

Download patch

ref: 4ae0c205f4f447958b41bb35dddff38a72807ea9
parent: 3164748dfa463e1c1ad393252eebe4e5c851a08e
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sat Dec 28 08:25:04 EST 2019

don't memset on NULL if malloc failed

--- a/hx.c
+++ b/hx.c
@@ -138,13 +138,12 @@
 {
 	int i, fd, res;
 
-	res = 0;
-
 	if ((buf = malloc(Bufsz)) == NULL) {
 		perror("buf");
-		res = 1;
+		return 1;
 	}
 
+	res = 0;
 	for (i = 1; i < argc && res == 0; i++) {
 		if ((fd = open(argv[i], O_RDONLY)) < 0) {
 			perror(argv[i]);