By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
*/
int virEventPollRunOnce(void)
{
- struct pollfd *fds = NULL;
+ VIR_AUTOFREE(struct pollfd *) fds = NULL;
int ret, timeout, nfds;
virMutexLock(&eventLoop.lock);
goto retry;
virReportSystemError(errno, "%s",
_("Unable to poll on file handles"));
- goto error_unlocked;
+ return -1;
}
EVENT_DEBUG("Poll got %d event(s)", ret);
eventLoop.running = 0;
virMutexUnlock(&eventLoop.lock);
- VIR_FREE(fds);
return 0;
error:
virMutexUnlock(&eventLoop.lock);
- error_unlocked:
- VIR_FREE(fds);
return -1;
}