Re: [PATCH] Remove VIR_FREE in favor of g_autofree in some functions in libvrit-domain.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Note that I had to drop the 'noreply.github.com' email address. Please
don't use that as the author credential as it makes hard to reply
properly to threads.

On Mon, Mar 11, 2024 at 02:15:32 +0200, Mostafa wrote:
> From: مصطفي محمود كمال الدين <48567303+moste00@xxxxxxxxxxxxxxxxxxxxxxxx>

Per contributor guidelines:

  Contributors to libvirt projects must assert that they are in
  compliance with the Developer Certificate of Origin 1.1. This is
  achieved by adding a "Signed-off-by" line containing the contributor's
  name and e-mail to every commit message. The presence of this line
  attests that the contributor has read the above lined DCO and agrees
  with its statements.

  https://www.libvirt.org/hacking.html#developer-certificate-of-origin

Please make sure to follow all points of that document, especially all
paragraphs about:

  https://www.libvirt.org/hacking.html#preparing-patches

in future postings.

> ---
>  src/libvirt-domain.c | 32 ++++++++------------------------
>  1 file changed, 8 insertions(+), 24 deletions(-)
> 
> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index 83abad251e..9b68a7ac95 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -884,7 +884,7 @@ virDomainSave(virDomainPtr domain, const char *to)
>  
>      if (conn->driver->domainSave) {
>          int ret;
> -        char *absolute_to;
> +        g_autofree char *absolute_to;
>  
>          /* We must absolutize the file path as the save is done out of process */
>          if (!(absolute_to = g_canonicalize_filename(to, NULL))) {


After this patch the code fails to compile:

In function ‘g_autoptr_cleanup_generic_gfree’,
    inlined from ‘virDomainSave’ at ../../../libvirt/src/libvirt-domain.c:887:2 :
/usr/include/glib-2.0/glib/glib-autocleanups.h:30:3: error: ‘absolute_to’ may be used uninitialized [-Werror=maybe-uninitialized]
   30 |   g_free (*pp);
      |   ^~~~~~~~~~~~
../../../libvirt/src/libvirt-domain.c: In function ‘virDomainSave’:
../../../libvirt/src/libvirt-domain.c:887:26: note: ‘absolute_to’ was declared here
  887 |         g_autofree char *absolute_to;
      |                          ^~~~~~~~~~~
In function ‘g_autoptr_cleanup_generic_gfree’,
    inlined from ‘virDomainSaveFlags’ at ../../../libvirt/src/libvirt-domain.c:975:26:
/usr/include/glib-2.0/glib/glib-autocleanups.h:30:3: error: ‘absolute_to’ may be used uninitialized [-Werror=maybe-uninitialized]
   30 |   g_free (*pp);
      |   ^~~~~~~~~~~~

When compiling the code by default from a git checkout we enable all
errors thus you should be getting this error or the syntax-check error
for the same thing if you have an older compiler. Make sure to both
compile and run tests as the contributor guidelines state.
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux