gdbstub: Fix memory leak

cppcheck report:
  gdbstub.c:1781: error: Memory leak: s

Rearranging of the code avoids the leak.

v2:
Replace the g_malloc0() by g_new0() (suggested by Stuart Brady).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
