diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2012-09-20 14:18:23 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2012-09-20 14:18:54 +0200 |
commit | 907093ff80f9935179f7e1cec8f66dd3ae329e89 (patch) | |
tree | 513089cdf1b5dce704e7e3533136c25b6c3f5c32 | |
parent | a0508cbf6d021b1c7549714b9c2907146317de66 (diff) | |
download | vconsole-907093ff80f9935179f7e1cec8f66dd3ae329e89.tar.gz |
plug more memory holes
-rw-r--r-- | connect.c | 9 | ||||
-rw-r--r-- | vconsole.c | 3 |
2 files changed, 9 insertions, 3 deletions
@@ -58,6 +58,7 @@ static void connect_close(virConnectPtr c, int reason, void *opaque) static void connect_list(struct vconsole_connect *conn) { + virDomainPtr d; int i, n; char **inactive; int *active; @@ -66,7 +67,9 @@ static void connect_list(struct vconsole_connect *conn) active = malloc(sizeof(int) * n); n = virConnectListDomains(conn->ptr, active, n); for (i = 0; i < n; i++) { - domain_update(conn, virDomainLookupByID(conn->ptr, active[i]), -1); + d = virDomainLookupByID(conn->ptr, active[i]); + domain_update(conn, d, -1); + virDomainFree(d); } free(active); @@ -74,7 +77,9 @@ static void connect_list(struct vconsole_connect *conn) inactive = malloc(sizeof(char *) * n); n = virConnectListDefinedDomains(conn->ptr, inactive, n); for (i = 0; i < n; i++) { - domain_update(conn, virDomainLookupByName(conn->ptr, inactive[i]), -1); + d = virDomainLookupByName(conn->ptr, inactive[i]); + domain_update(conn, d, -1); + virDomainFree(d); free(inactive[i]); } free(inactive); @@ -39,6 +39,7 @@ void config_write(void) write(fd, data, len); fsync(fd); close(fd); + g_free(data); } /* ------------------------------------------------------------------ */ @@ -629,7 +630,7 @@ static void vconsole_build_recent(struct vconsole_window *win) g_free(h); g_free(action); } - g_free(keys); + g_strfreev(keys); /* finish */ xml = g_strdup_printf(recent_xml, entries ? entries : ""); |