diff options
author | Ondrej Oprala | 2013-09-23 15:39:27 +0200 |
---|---|---|
committer | Karel Zak | 2013-11-08 12:54:53 +0100 |
commit | 53a9a9939e40162e200ca2910b3ac0bcaf5ecb15 (patch) | |
tree | 8146fe27a6710bb52ec5ffe6774aed22e6318a52 /text-utils/conv.c | |
parent | hexdump: delete redundant typecasts (diff) | |
download | kernel-qcow2-util-linux-53a9a9939e40162e200ca2910b3ac0bcaf5ecb15.tar.gz kernel-qcow2-util-linux-53a9a9939e40162e200ca2910b3ac0bcaf5ecb15.tar.xz kernel-qcow2-util-linux-53a9a9939e40162e200ca2910b3ac0bcaf5ecb15.zip |
hexdump: use xasprintf in conv_c()
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Diffstat (limited to 'text-utils/conv.c')
-rw-r--r-- | text-utils/conv.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/text-utils/conv.c b/text-utils/conv.c index 4f7a248f2..abb62d06d 100644 --- a/text-utils/conv.c +++ b/text-utils/conv.c @@ -35,11 +35,12 @@ #include <ctype.h> #include <sys/types.h> #include "hexdump.h" +#include "xalloc.h" void conv_c(PR *pr, u_char *p) { - char buf[10]; + char *buf = NULL; char const *str; switch(*p) { @@ -75,11 +76,12 @@ conv_c(PR *pr, u_char *p) *pr->cchar = 'c'; printf(pr->fmt, *p); } else { - sprintf(buf, "%03o", (int)*p); + xasprintf(&buf, "%03o", (int)*p); str = buf; strpr: *pr->cchar = 's'; printf(pr->fmt, str); } + free(buf); } void |