Use g_renew instead of freeing and reusing the memory

This commit is contained in:
David Benjamin 2011-06-28 20:33:37 -07:00
parent 173fc6a221
commit e80bd44a50
1 changed files with 1 additions and 2 deletions

View File

@ -4953,9 +4953,8 @@ static int do_main(int argc, char **argv, const char *connection_path)
while ((needed_fds = g_main_context_query(context, max_priority, &timeout,
fds + 1, nfds - 1)) > nfds - 1) {
// Reallocate to make room
g_free(fds);
nfds = needed_fds + 1;
fds = g_new0(GPollFD, nfds);
fds = g_renew(GPollFD, fds, nfds);
fds[0].fd = rpc_socket(g_rpc_connection);
fds[0].events = G_IO_IN;
}