From: Marc-André Lureau <marcandre.lur...@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> [PMD: added net/slirp.c] --- net/slirp.c | 4 ++-- slirp/slirp.c | 2 +- slirp/socket.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/slirp.c b/net/slirp.c index 318a26e892..c42e1fd0d0 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -869,7 +869,7 @@ net_init_slirp_configs(const StringList *fwd, int flags) while (fwd) { struct slirp_config_str *config; - config = g_malloc0(sizeof(*config)); + config = g_new0(struct slirp_config_str, 1); pstrcpy(config->str, sizeof(config->str), fwd->value->str); config->flags = flags; config->next = slirp_configs; @@ -973,7 +973,7 @@ int net_slirp_parse_legacy(QemuOptsList *opts_list, const char *optarg, int *ret if (QTAILQ_EMPTY(&slirp_stacks)) { struct slirp_config_str *config; - config = g_malloc(sizeof(*config)); + config = g_new(struct slirp_config_str, 1); pstrcpy(config->str, sizeof(config->str), optarg); config->flags = SLIRP_CFG_LEGACY; config->next = slirp_configs; diff --git a/slirp/slirp.c b/slirp/slirp.c index 1cb6b07004..9af9179afa 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -288,7 +288,7 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, struct in6_addr vnameserver6, const char **vdnssearch, void *opaque) { - Slirp *slirp = g_malloc0(sizeof(Slirp)); + Slirp *slirp = g_new0(Slirp, 1); slirp_init_once(); diff --git a/slirp/socket.c b/slirp/socket.c index cb7b5b608d..2eccb68c2e 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -48,7 +48,7 @@ socreate(Slirp *slirp) { struct socket *so; - so = (struct socket *)malloc(sizeof(struct socket)); + so = g_new(struct socket, 1); if(so) { memset(so, 0, sizeof(struct socket)); so->so_state = SS_NOFDREF; -- 2.14.2