]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hexdump: use xcalloc()
authorKarel Zak <kzak@redhat.com>
Mon, 6 Jan 2014 12:54:48 +0000 (13:54 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 6 Jan 2014 12:54:48 +0000 (13:54 +0100)
Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/hexdump.c

index e9fca0294185f4f73b5ba7da62f528da7d7da6bb..d3d87dd57eefce4ea456fce81362c86cb5855910 100644 (file)
@@ -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);