[ofw] [PATCH] libdat v2.0: memory leak in static registration during parsing

Fab Tillier ftillier at microsoft.com
Tue Dec 7 13:35:54 PST 2010


Davis, Arlin R wrote on Mon, 6 Dec 2010 at 16:22:50
> 
> the platform_params char string, allocated when parsing dat.conf, is
> not freed.
> 
> Signed-off-by: Arlin Davis <arlin.r.davis at intel.com>
> ---
>  dat/udat/udat_sr_parser.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/dat/udat/udat_sr_parser.c b/dat/udat/udat_sr_parser.c
> index 3b5caef..1d5f0d8 100644
> --- a/dat/udat/udat_sr_parser.c
> +++ b/dat/udat/udat_sr_parser.c
> @@ -492,6 +492,12 @@ DAT_RETURN dat_sr_parse_entry(DAT_OS_FILE * file)
>  					    1));
>  	}
> 
> +	if (NULL != entry.platform_params) {

Yoda logic here you have.

-Fab

> +		dat_os_free(entry.platform_params,
> +			    sizeof(char) *
> +			    (dat_os_strlen(entry.platform_params) +  1));
> +	}
> +
>  	return status;
>  }
> 
> --
> 1.7.3
> 
> 
> 
> _______________________________________________
> ofw mailing list
> ofw at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw




More information about the ofw mailing list