From 2152af72894e95eb40aa2a1e5a5b3116cf7c659a Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 6 Jan 2014 13:54:48 +0100 Subject: [PATCH] hexdump: use xcalloc() Reported-by: Andrey Vagin Signed-off-by: Karel Zak --- text-utils/hexdump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/text-utils/hexdump.c b/text-utils/hexdump.c index e9fca02941..d3d87dd57e 100644 --- a/text-utils/hexdump.c +++ b/text-utils/hexdump.c @@ -50,6 +50,7 @@ #include "nls.h" #include "c.h" #include "strutils.h" +#include "xalloc.h" #include "closestream.h" void hex_free(struct hexdump *); @@ -167,7 +168,7 @@ int main(int argc, char **argv) struct hexdump_fs *tfs; char *c; - struct hexdump *hex = malloc (sizeof (struct hexdump)); + struct hexdump *hex = xcalloc(1, sizeof (struct hexdump)); hex->length = -1; INIT_LIST_HEAD(&hex->fshead); -- 2.47.2