Commit fcde04d9acbe8328a5e476c6d1391b563ea14783

Stefan Sperling 2019-05-13T11:26:18

another malloc failure check in collect_commit_msg()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/got/got.c b/got/got.c
index be07889..4c27673 100644
--- a/got/got.c
+++ b/got/got.c
@@ -2243,6 +2243,10 @@ collect_commit_logmsg(struct got_pathlist_head *commitable_paths, char **logmsg,
 
 	/* remove comments */
 	*logmsg = malloc(st2.st_size + 1);
+	if (*logmsg == NULL) {
+		err = got_error_prefix_errno("malloc");
+		goto done;
+	}
 	len = 0;
 
 	fp = fopen(tmpfile, "r");