From: Karel Zak Date: Thu, 6 Oct 2022 10:00:57 +0000 (+0200) Subject: libmount: don't refer optlist when copy libmnt_fs X-Git-Tag: v2.39-rc1~243 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=22c4b54801d44b2d887dce7e494399e3ce9e4cac;p=thirdparty%2Futil-linux.git libmount: don't refer optlist when copy libmnt_fs Signed-off-by: Karel Zak --- diff --git a/libmount/src/fs.c b/libmount/src/fs.c index c7858898a4..5e5d6dc289 100644 --- a/libmount/src/fs.c +++ b/libmount/src/fs.c @@ -59,8 +59,6 @@ void mnt_free_fs(struct libmnt_fs *fs) DBG(FS, ul_debugobj(fs, "free [refcount=%d]", fs->refcount)); - mnt_unref_optlist(fs->optlist); - mnt_reset_fs(fs); free(fs); } @@ -97,6 +95,9 @@ void mnt_reset_fs(struct libmnt_fs *fs) free(fs->opt_fields); free(fs->comment); + mnt_unref_optlist(fs->optlist); + fs->optlist = NULL; + fs->opts_age = 0; memset(fs, 0, sizeof(*fs)); @@ -236,7 +237,7 @@ int mnt_fs_follow_optlist(struct libmnt_fs *fs, struct libmnt_optlist *ol) * set, then the field is NOT overwritten. * * This function does not copy userdata (se mnt_fs_set_userdata()). A new copy is - * not linked with any existing mnt_tab. + * not linked with any existing mnt_tab or optlist. * * Returns: @dest or NULL in case of error */ @@ -294,10 +295,6 @@ struct libmnt_fs *mnt_copy_fs(struct libmnt_fs *dest, dest->usedsize = src->usedsize; dest->priority = src->priority; - dest->opts_age = src->opts_age; - dest->optlist = src->optlist; - mnt_ref_optlist(dest->optlist); - return dest; err: if (!org)