alsactl: simple coverity fix

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2019-03-12 16:05:23 +01:00
parent a558b71e63
commit cf2cc37502

View file

@ -1675,8 +1675,10 @@ static int parse(struct space *space, const char *filename)
linenum = 0; linenum = 0;
linesize = 128; linesize = 128;
line = malloc(linesize); line = malloc(linesize);
if (line == NULL) if (line == NULL) {
file_unmap(buf, bufsize);
return -ENOMEM; return -ENOMEM;
}
space->filename = filename; space->filename = filename;
while (!err && pos < bufsize && !space->quit) { while (!err && pos < bufsize && !space->quit) {
count = line_width(buf, bufsize, pos); count = line_width(buf, bufsize, pos);