Commit de0715d5 authored by Michael Heimpold's avatar Michael Heimpold Committed by Chris Ball
Browse files

Check calloc's return value before using the pointer



If calloc fails, bail out immediately instead of trying to
use the NULL pointer.
Signed-off-by: default avatarMichael Heimpold <michael.heimpold@i2se.com>
Cc: Michael Heimpold <mhei@heimpold.de>
Reviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
Signed-off-by: default avatarChris Ball <chris@printf.net>
parent d40ec535
......@@ -374,6 +374,8 @@ char *to_binstr(char *hexstr)
char *binstr;
binstr = calloc(strlen(hexstr) * 4 + 1, sizeof(char));
if (!binstr)
return NULL;
while (hexstr && *hexstr != '\0') {
if (!isxdigit(*hexstr))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment