[Ocfs2-tools-devel] [PATCH 1/1] ocfs2-tools: fix wrong pointer to pointer in mount.ocfs2
Sunil Mushran
sunil.mushran at oracle.com
Wed Mar 30 17:16:46 PDT 2011
On 03/29/2011 08:26 PM, Tiger Yang wrote:
> commit 52bae5e7a358e927a1e841ead2c6a95cf68c5db1 use the wrong
> pointer to pointer in if statement. This patch fixes this problem
> and clean the codes to create option string.
>
> Signed-off-by: Tiger Yang<tiger.yang at oracle.com>
> ---
> mount.ocfs2/mount.ocfs2.c | 8 +++-----
> 1 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/mount.ocfs2/mount.ocfs2.c b/mount.ocfs2/mount.ocfs2.c
> index a5e117d..4925f20 100644
> --- a/mount.ocfs2/mount.ocfs2.c
> +++ b/mount.ocfs2/mount.ocfs2.c
> @@ -133,11 +133,9 @@ static errcode_t add_mount_options(ocfs2_filesys *fs,
> add = OCFS2_HB_LOCAL;
>
> addit:
> - if (optstr&& *optstr) {
> - extra = xstrndup(*optstr, strlen(*optstr) + strlen(add) + 1);
> - if (extra)
> - extra = xstrconcat3(extra, ",", add);
> - } else
> + if (*optstr&& *(*optstr))
> + extra = xstrconcat3(*optstr, ",", add);
This function calls free(*optstr). Probably not what we want as
it could lead to a double free.
This code has been there forever. Why is this problem happening now?
> + else
> extra = xstrndup(add, strlen(add));
>
> if (!extra)
More information about the Ocfs2-tools-devel
mailing list