libmount: make sure we deallocate on parse error

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2018-03-20 12:20:05 +01:00
parent a0357292b5
commit 4c9e4ce83c
1 changed files with 4 additions and 2 deletions

View File

@ -216,12 +216,14 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
if (!fs->optstr)
rc = -ENOMEM;
} else {
free(fstype);
free(src);
DBG(TAB, ul_debug(
"mountinfo parse error [sscanf rc=%d]: '%s'", rc, s));
rc = -EINVAL;
}
free(fstype);
free(src);
return rc;
}