summaryrefslogtreecommitdiffstats
path: root/qarshd.c
diff options
context:
space:
mode:
authorNathan Straz <nstraz@redhat.com>2013-08-30 17:29:49 -0400
committerNathan Straz <nstraz@redhat.com>2013-09-11 17:50:01 -0400
commit874437972c52cb17950a142d4481cfa073e74635 (patch)
tree2a0795e7c3e02c6d30d0bca16288fe5a489f2afd /qarshd.c
parent61899fcf3ee83e7832ec43767209bc40dbd605e6 (diff)
downloadqarsh-874437972c52cb17950a142d4481cfa073e74635.tar.gz
qarsh-874437972c52cb17950a142d4481cfa073e74635.tar.xz
qarsh-874437972c52cb17950a142d4481cfa073e74635.zip
Clean up memory leaks and uninitialized variables in qarshd
Diffstat (limited to 'qarshd.c')
-rw-r--r--qarshd.c5
1 files changed, 5 insertions, 0 deletions
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);