comparison svr-chansession.c @ 1040:2b4fd440399d

Free memory before exiting. Based on patch from Thorsten Horstmann. Client side is not complete.
author Matt Johnston <matt@ucc.asn.au>
date Tue, 24 Feb 2015 22:01:33 +0800
parents d3925ed45a85
children 9699b9438ad9
comparison
equal deleted inserted replaced
1039:d0e6dd5af46e 1040:2b4fd440399d
785 if (pid == 0) { 785 if (pid == 0) {
786 /* child */ 786 /* child */
787 787
788 TRACE(("back to normal sigchld")) 788 TRACE(("back to normal sigchld"))
789 /* Revert to normal sigchld handling */ 789 /* Revert to normal sigchld handling */
790 /*
790 if (signal(SIGCHLD, SIG_DFL) == SIG_ERR) { 791 if (signal(SIGCHLD, SIG_DFL) == SIG_ERR) {
791 dropbear_exit("signal() error"); 792 dropbear_exit("signal() error");
792 } 793 }
794 */
793 795
794 /* redirect stdin/stdout/stderr */ 796 /* redirect stdin/stdout/stderr */
795 close(chansess->master); 797 close(chansess->master);
796 798
797 pty_make_controlling_tty(&chansess->slave, chansess->tty); 799 pty_make_controlling_tty(&chansess->slave, chansess->tty);
1003 svr_ses.childpidsize = 1; 1005 svr_ses.childpidsize = 1;
1004 svr_ses.lastexit.exitpid = -1; /* Nothing has exited yet */ 1006 svr_ses.lastexit.exitpid = -1; /* Nothing has exited yet */
1005 sa_chld.sa_handler = sesssigchild_handler; 1007 sa_chld.sa_handler = sesssigchild_handler;
1006 sa_chld.sa_flags = SA_NOCLDSTOP; 1008 sa_chld.sa_flags = SA_NOCLDSTOP;
1007 sigemptyset(&sa_chld.sa_mask); 1009 sigemptyset(&sa_chld.sa_mask);
1010 /*
1008 if (sigaction(SIGCHLD, &sa_chld, NULL) < 0) { 1011 if (sigaction(SIGCHLD, &sa_chld, NULL) < 0) {
1009 dropbear_exit("signal() error"); 1012 dropbear_exit("signal() error");
1010 } 1013 }
1014 */
1011 1015
1012 } 1016 }
1013 1017
1014 /* add a new environment variable, allocating space for the entry */ 1018 /* add a new environment variable, allocating space for the entry */
1015 void addnewvar(const char* param, const char* var) { 1019 void addnewvar(const char* param, const char* var) {