From 874437972c52cb17950a142d4481cfa073e74635 Mon Sep 17 00:00:00 2001 From: Nathan Straz Date: Fri, 30 Aug 2013 17:29:49 -0400 Subject: Clean up memory leaks and uninitialized variables in qarshd --- qarshd.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'qarshd.c') diff --git a/qarshd.c b/qarshd.c index 2bb6509..093e001 100644 --- a/qarshd.c +++ b/qarshd.c @@ -299,6 +299,8 @@ handle_qarsh() for (;;) { + timeout.tv_sec = 3; + timeout.tv_nsec = 0; FD_ZERO(&rfds); FD_ZERO(&wfds); FD_SET(qinfd, &rfds); maxfd = qinfd; @@ -314,6 +316,7 @@ handle_qarsh() FD_SET(childfds[2], &rfds); maxfd = childfds[2] > maxfd ? childfds[2] : maxfd; } + nfd = pselect(maxfd+1, &rfds, &wfds, NULL, &timeout, &orig_sigmask); if (child_exitted) { @@ -379,6 +382,7 @@ handle_qarsh() break; } nfd--; + qpfree(qp); } if (nfd && FD_ISSET(childfds[0], &wfds)) { /* Child is ready for data on stdin */ @@ -487,6 +491,7 @@ handle_packets() child_pid = run_cmd(qp->qp_runcmd.qp_cmdline); qpfree(qp); handle_qarsh(); /* continue processing qarsh separately */ + return; break; case QP_RECVFILE: /* Setup file descriptors to handle incoming data */ rp = prepare_recvfile(qp); -- cgit