Fix memory leaks found with valgrind

Signed-off-by: Lon Hohberger <lon@users.sourceforge.net>
This commit is contained in:
Lon Hohberger 2010-01-14 18:46:21 -05:00
parent 1fce42fdb0
commit 16aafe3974
6 changed files with 11 additions and 2 deletions

View File

@ -465,9 +465,11 @@ libvirt_shutdown(backend_context_t c)
VALIDATE(info); VALIDATE(info);
if (virConnectClose(info->vp) < 0) { if (virConnectClose(info->vp) < 0) {
free(info);
return -errno; return -errno;
} }
free(info);
return 0; return 0;
} }

View File

@ -569,6 +569,8 @@ mcast_shutdown(listener_context_t c)
VALIDATE(info); VALIDATE(info);
info->magic = 0; info->magic = 0;
history_wipe(info->history);
free(info->history);
free(info->args.key_file); free(info->args.key_file);
free(info->args.addr); free(info->args.addr);
close(info->mc_sock); close(info->mc_sock);

View File

@ -391,6 +391,8 @@ serial_shutdown(listener_context_t c)
info->magic = 0; info->magic = 0;
stop_event_listener(); stop_event_listener();
domain_sock_cleanup(); domain_sock_cleanup();
history_wipe(info->history);
free(info->history);
free(info->uri); free(info->uri);
free(info->path); free(info->path);
free(info); free(info);

View File

@ -28,7 +28,7 @@ struct perm_group {
static void static void
static_map_cleanup(void **info) static_map_cleanup(void **info)
{ {
struct perm_group *groups = (struct perm_group *)info; struct perm_group *groups = (struct perm_group *)(*info);
struct perm_group *group; struct perm_group *group;
struct perm_entry *entry; struct perm_entry *entry;

View File

@ -562,7 +562,7 @@ int
stop_event_listener(void) stop_event_listener(void)
{ {
run = 0; run = 0;
pthread_cancel(event_tid); //pthread_cancel(event_tid);
pthread_join(event_tid, NULL); pthread_join(event_tid, NULL);
event_tid = 0; event_tid = 0;

View File

@ -46,6 +46,9 @@ domain_sock_setup(const char *domain, const char *socket_path)
if (connect(sock, (struct sockaddr *)sun, SUN_LEN(sun)) < 0) if (connect(sock, (struct sockaddr *)sun, SUN_LEN(sun)) < 0)
goto out_fail; goto out_fail;
free(sun);
sun = NULL;
node = malloc(sizeof(*node)); node = malloc(sizeof(*node));
if (!node) if (!node)
goto out_fail; goto out_fail;