When mnt_split_optstr() failed in the middle, vfs, fs, user optstr's
are freed but not reset. It can lead to double frees at the end of
mnt_fs_{ap,pre}pend_options().
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
rc = __mnt_optstr_append_option(fs, name, namesz,
val, valsz);
if (rc) {
- if (vfs)
+ if (vfs) {
free(*vfs);
- if (fs)
+ *vfs = NULL;
+ }
+ if (fs) {
free(*fs);
- if (user)
+ *fs = NULL;
+ }
+ if (user) {
free(*user);
+ *user = NULL;
+ }
return rc;
}
}