test-prio-queue: use xmalloc
test-prio-queue.c doesn't check the return value of malloc, and could segfault. It's unlikely for this to matter in practice; it's a small allocation, and this code isn't even installed alongside the rest of Git. But let's use xmalloc(), which makes auditing for other accidental uses of bare malloc() easier. Reported-by: 王健强 <jianqiang.wang@securitygossip.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Apr 11, 2019 at 09:48 UTC
73a5faf0176548640784090190bb2448cf1708aa
1 file changed
+1
-1
t/helper/test-prio-queue.c
+1
-1
@@ -40,7 +40,7 @@ int cmd__prio_queue(int argc, const char **argv)
40
} else if (!strcmp(*argv, "stack")) {
41
pq.compare = NULL;
42
} else {
43
- int *v = malloc(sizeof(*v));
43
+ int *v = xmalloc(sizeof(*v));
44
*v = atoi(*argv);
45
prio_queue_put(&pq, v);
46
}