[libvirt] [PATCH] Fix valgrind complaints when using kill -SIGHUP on libvirtd

Daniel P. Berrange berrange at redhat.com
Thu Aug 12 20:26:26 UTC 2010


On Thu, Aug 12, 2010 at 02:58:15PM -0400, Stefan Berger wrote:
>  This patch fixes a couple of complaints from valgrind when tickling 
> libvirtd with SIGHUP.

> Index: libvirt-acl/src/conf/nwfilter_conf.c
> ===================================================================
> --- libvirt-acl.orig/src/conf/nwfilter_conf.c
> +++ libvirt-acl/src/conf/nwfilter_conf.c
> @@ -2239,6 +2239,7 @@ virNWFilterPoolObjLoad(virConnectPtr con
>          return NULL;
>      }
> 
> +    VIR_FREE(pool->configFile); // for driver reload
>      pool->configFile = strdup(path);
>      if (pool->configFile == NULL) {
>          virReportOOMError();
> Index: libvirt-acl/src/conf/storage_conf.c
> ===================================================================
> --- libvirt-acl.orig/src/conf/storage_conf.c
> +++ libvirt-acl/src/conf/storage_conf.c
> @@ -1403,12 +1403,14 @@ virStoragePoolObjLoad(virStoragePoolObjL
>          return NULL;
>      }
> 
> +    VIR_FREE(pool->configFile);  // for driver reload
>      pool->configFile = strdup(path);
>      if (pool->configFile == NULL) {
>          virReportOOMError();
>          virStoragePoolDefFree(def);
>          return NULL;
>      }
> +    VIR_FREE(pool->autostartLink); // for driver reload
>      pool->autostartLink = strdup(autostartLink);
>      if (pool->autostartLink == NULL) {
>          virReportOOMError();
> Index: libvirt-acl/src/util/util.c
> ===================================================================
> --- libvirt-acl.orig/src/util/util.c
> +++ libvirt-acl/src/util/util.c
> @@ -941,9 +941,11 @@ virPipeReadUntilEOF(int outfd, int errfd
> 
>      fds[0].fd = outfd;
>      fds[0].events = POLLIN;
> +    fds[0].revents = 0;
>      finished[0] = 0;
>      fds[1].fd = errfd;
>      fds[1].events = POLLIN;
> +    fds[1].revents = 0;
>      finished[1] = 0;
> 
>      while(!(finished[0] && finished[1])) {
> Index: libvirt-acl/src/cpu/cpu_x86.c
> ===================================================================
> --- libvirt-acl.orig/src/cpu/cpu_x86.c
> +++ libvirt-acl/src/cpu/cpu_x86.c
> @@ -1092,6 +1092,12 @@ x86MapFree(struct x86_map *map)
>          x86ModelFree(model);
>      }
> 
> +    while (map->vendors != NULL) {
> +        struct x86_vendor *vendor = map->vendors;
> +        map->vendors = vendor->next;
> +        x86VendorFree(vendor);
> +    }
> +
>      VIR_FREE(map);
>  }

ACK, all looks good

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list