diff options
author | Nathan Straz <nstraz@redhat.com> | 2013-08-30 17:29:49 -0400 |
---|---|---|
committer | Nathan Straz <nstraz@redhat.com> | 2013-09-11 17:50:01 -0400 |
commit | 874437972c52cb17950a142d4481cfa073e74635 (patch) | |
tree | 2a0795e7c3e02c6d30d0bca16288fe5a489f2afd /qarshd.c | |
parent | 61899fcf3ee83e7832ec43767209bc40dbd605e6 (diff) | |
download | qarsh-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.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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); |