[Ocfs2-tools-devel] [PATCH] libocfs2: fix small memory leak in parse_feature()

Tao Ma tao.ma at oracle.com
Thu May 22 19:00:44 PDT 2008


Signed-off-by: Tao Ma <tao.ma at oracle.com>

Mark Fasheh wrote:
> We need to free the strdup'd string in case of error too.
> 
> Signed-off-by: Mark Fasheh <mfasheh at suse.com>
> ---
>  libocfs2/feature_string.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/libocfs2/feature_string.c b/libocfs2/feature_string.c
> index 831edc1..bba800a 100644
> --- a/libocfs2/feature_string.c
> +++ b/libocfs2/feature_string.c
> @@ -224,8 +224,10 @@ errcode_t parse_feature(const char *opts,
>  				break;
>  			}
>  		}
> -		if (!ocfs2_supported_features[i].ff_str)
> +		if (!ocfs2_supported_features[i].ff_str) {
> +			free(options);
>  			return OCFS2_ET_UNSUPP_FEATURE;
> +		}
>  	}
>  
>  	free(options);



More information about the Ocfs2-tools-devel mailing list