Fix valgrind complaints when using kill -SIGHUP on libvirtd

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.
This commit is contained in:
Stefan Berger 2010-08-12 16:30:11 -04:00
parent 986c208695
commit 18b6323ab9
4 changed files with 11 additions and 0 deletions

View 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();

View 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();

View 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);
}

View 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])) {