gdb_server: Add check for malloc fail