[lvm-devel] [PATCH] Use dynamic allocation for buffer when reporting tags

Zdenek Kabelac zkabelac at redhat.com
Mon Nov 1 13:21:47 UTC 2010


Dne 1.11.2010 14:08, Peter Rajnoha napsal(a):
> OK, here's updated version (based on quick hints from Milan).
> 
> Peter
> ---
>  libdm/libdm-report.c |   52 ++++++++++++++++++++++++++++++++++++++++---------
>  1 files changed, 42 insertions(+), 10 deletions(-)
> 
> diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
> index 7631e21..951ecb3 100644
> --- a/libdm/libdm-report.c
> +++ b/libdm/libdm-report.c
> @@ -902,11 +919,13 @@ static int _output_field(struct dm_report *rh, struct dm_report_field *field)
>  
>  		if (!dm_pool_grow_object(rh->mem, rh->output_field_name_prefix, 0)) {
>  			log_error("dm_report: Unable to extend output line");
> +			free(field_id);
>  			return 0;
>  		}
>  
>  		if (!dm_pool_grow_object(rh->mem, _toupperstr(field_id), 0)) {
>  			log_error("dm_report: Unable to extend output line");
> +			free(field_id);
>  			return 0;
>  		}


Maybe swith to use dm_strdup() and dm_free()

Zdenek




More information about the lvm-devel mailing list