Codebase list mmc-utils / de0715d
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: Michael Heimpold <michael.heimpold@i2se.com> Cc: Michael Heimpold <mhei@heimpold.de> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Chris Ball <chris@printf.net> Michael Heimpold authored 5 years ago Chris Ball committed 4 years ago
1 changed file(s) with 2 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
373373 char *binstr;
374374
375375 binstr = calloc(strlen(hexstr) * 4 + 1, sizeof(char));
376 if (!binstr)
377 return NULL;
376378
377379 while (hexstr && *hexstr != '\0') {
378380 if (!isxdigit(*hexstr))