[virt-tools-list] [PATCH 2/2] Fix "__warn_memset_zero_len"

Daniel P. Berrange berrange at redhat.com
Fri Mar 23 13:04:38 UTC 2012


On Fri, Mar 23, 2012 at 09:05:57AM -0300, Fabiano Fidêncio wrote:
> ---
>  tools/osinfo-query.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/osinfo-query.c b/tools/osinfo-query.c
> index 8c96b62..69b789a 100644
> --- a/tools/osinfo-query.c
> +++ b/tools/osinfo-query.c
> @@ -251,9 +251,11 @@ static gboolean print_entity_text(OsinfoEntity *entity,
>              pad = labels[i].width - (val ? strlen(val) : 0);
>  
>          padstr = g_new0(gchar, pad+1);
> -        memset(padstr, ' ', pad);
>          padstr[pad] = '\0';
>  
> +        if (pad)
> +            memset(padstr, ' ', pad);
> +
>          g_print("%s%s",
>                  val ? val : "", padstr);
>          g_free(padstr);
> @@ -295,9 +297,11 @@ static gboolean print_results_text(OsinfoList *list,
>              pad = labels[i].width - strlen(labels[i].label);
>  
>          padstr = g_new0(gchar, pad+1);
> -        memset(padstr, ' ', pad);
>          padstr[pad] = '\0';
>  
> +        if (pad)
> +            memset(padstr, ' ', pad);
> +
>          g_print("%s%s",
>                  labels[i].label, padstr);
>          g_free(padstr);

ACK and applied to GIT

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the virt-tools-list mailing list