]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix valgrind complaints when using kill -SIGHUP on libvirtd
authorStefan Berger <stefanb@us.ibm.com>
Thu, 12 Aug 2010 20:30:11 +0000 (16:30 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Thu, 12 Aug 2010 20:30:11 +0000 (16:30 -0400)
This patch fixes a couple of complaints from valgrind when tickling libvirtd with SIGHUP.

The first two files contain fixes for memory leaks. The 3rd one initializes an uninitialized variable. The 4th one is another memory leak.

src/conf/nwfilter_conf.c
src/conf/storage_conf.c
src/cpu/cpu_x86.c
src/util/util.c

index fd3d805077d6b52364192fac675c3dd297a6a789..2ac18511e9928027a0cbeacc389074a7113d1310 100644 (file)
@@ -2239,6 +2239,7 @@ virNWFilterPoolObjLoad(virConnectPtr conn,
         return NULL;
     }
 
+    VIR_FREE(pool->configFile); // for driver reload
     pool->configFile = strdup(path);
     if (pool->configFile == NULL) {
         virReportOOMError();
index bf86c9342f6e7dac914e34e32ae7e5730b996d6b..18a6472512b100d76af321b5d830f1a51f1f50c4 100644 (file)
@@ -1403,12 +1403,14 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pools,
         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 ab7c8cc77eb1307d17d4a6bfba6a73612a13766b..19379016d0284f6738fb51021253299adbed31d1 100644 (file)
@@ -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);
 }
 
index c173e491d01dca63397a6049a3a4be776e1ed0b5..9679dc908f1f8cd815b3c88cf9c2c499cf0cea11 100644 (file)
@@ -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])) {