From: Karel Zak Date: Mon, 6 Jan 2014 12:54:48 +0000 (+0100) Subject: hexdump: use xcalloc() X-Git-Tag: v2.25-rc1~663 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2152af72894e95eb40aa2a1e5a5b3116cf7c659a;p=thirdparty%2Futil-linux.git hexdump: use xcalloc() Reported-by: Andrey Vagin Signed-off-by: Karel Zak --- 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);