diff --git a/util/supermicro/smcbiosinfo/smcbiosinfo.c b/util/supermicro/smcbiosinfo/smcbiosinfo.c index 6a27ba7a77..c55cb46013 100644 --- a/util/supermicro/smcbiosinfo/smcbiosinfo.c +++ b/util/supermicro/smcbiosinfo/smcbiosinfo.c @@ -101,15 +101,16 @@ static int get_line_as_int(char *fn, char *match, int bcd) ret = strtol(s, &endptr, 0); if (*endptr != '\0' && *endptr != '\n') { fprintf(stderr, "E: Couldn't parse number for key '%s'\n", match); + free(s); return -1; } if (bcd) ret = bcd2int(ret); - free(s); } else { fprintf(stderr, "E: Got invalid line for key '%s'\n", match); } + free(s); return ret; }