diff mbox series

[78/88] gdb: use g_new() family of functions

Message ID 20171006235023.11952-79-f4bug@amsat.org
State New
Headers show
Series use g_new() family of functions | expand

Commit Message

Philippe Mathieu-Daudé Oct. 6, 2017, 11:50 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 gdbstub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alex Bennée Oct. 9, 2017, 9:38 a.m. UTC | #1
Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  gdbstub.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gdbstub.c b/gdbstub.c
> index 2a94030d3b..5f0d8af1c0 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -1786,7 +1786,7 @@ static void gdb_accept(void)
>      /* set short latency */
>      socket_set_nodelay(fd);
>
> -    s = g_malloc0(sizeof(GDBState));
> +    s = g_new0(GDBState, 1);
>      s->c_cpu = first_cpu;
>      s->g_cpu = first_cpu;
>      s->fd = fd;
> @@ -1980,7 +1980,7 @@ int gdbserver_start(const char *device)
>
>      s = gdbserver_state;
>      if (!s) {
> -        s = g_malloc0(sizeof(GDBState));
> +        s = g_new0(GDBState, 1);
>          gdbserver_state = s;
>
>          qemu_add_vm_change_state_handler(gdb_vm_state_change, NULL);


--
Alex Bennée
diff mbox series

Patch

diff --git a/gdbstub.c b/gdbstub.c
index 2a94030d3b..5f0d8af1c0 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1786,7 +1786,7 @@  static void gdb_accept(void)
     /* set short latency */
     socket_set_nodelay(fd);
 
-    s = g_malloc0(sizeof(GDBState));
+    s = g_new0(GDBState, 1);
     s->c_cpu = first_cpu;
     s->g_cpu = first_cpu;
     s->fd = fd;
@@ -1980,7 +1980,7 @@  int gdbserver_start(const char *device)
 
     s = gdbserver_state;
     if (!s) {
-        s = g_malloc0(sizeof(GDBState));
+        s = g_new0(GDBState, 1);
         gdbserver_state = s;
 
         qemu_add_vm_change_state_handler(gdb_vm_state_change, NULL);