slirp: fix slirp_add_exec() leaks
Free the list elements allocated in add_exec(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
parent
b7f43bf2f6
commit
c27f247865
@ -12,7 +12,7 @@ struct ex_list {
|
||||
void *ex_chardev;
|
||||
struct in_addr ex_addr; /* Server address */
|
||||
int ex_fport; /* Port to telnet to */
|
||||
const char *ex_exec; /* Command line of what to exec */
|
||||
char *ex_exec; /* Command line of what to exec */
|
||||
struct ex_list *ex_next;
|
||||
};
|
||||
|
||||
|
@ -342,6 +342,14 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork,
|
||||
|
||||
void slirp_cleanup(Slirp *slirp)
|
||||
{
|
||||
struct ex_list *e, *next;
|
||||
|
||||
for (e = slirp->exec_list; e; e = next) {
|
||||
next = e->ex_next;
|
||||
g_free(e->ex_exec);
|
||||
g_free(e);
|
||||
}
|
||||
|
||||
QTAILQ_REMOVE(&slirp_instances, slirp, entry);
|
||||
|
||||
unregister_savevm(NULL, "slirp", slirp);
|
||||
|
Loading…
Reference in New Issue
Block a user