Skip to content
Browse files

main: Don’t leak desired_ip memory

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

Closes #385.
  • Loading branch information...
1 parent b9763b6 commit ba8d013609b5ce9e78f7ff2bd3780b7f3f63be2f @andersk andersk committed with keithw
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/frontend/mosh-server.cc
View
8 src/frontend/mosh-server.cc
@@ -160,8 +160,9 @@ int main( int argc, char *argv[] )
/* Detect edge case */
fatal_assert( argc > 0 );
- char *desired_ip = NULL;
- char *desired_port = NULL;
+ const char *desired_ip = NULL;
+ string desired_ip_str;
+ const char *desired_port = NULL;
string command_path;
char **command_argv = NULL;
int colors = 0;
@@ -194,7 +195,8 @@ int main( int argc, char *argv[] )
desired_port = optarg;
break;
case 's':
- desired_ip = strdup( get_SSH_IP().c_str() );
+ desired_ip_str = get_SSH_IP();
+ desired_ip = desired_ip_str.c_str();
fatal_assert( desired_ip );
break;
case 'c':

0 comments on commit ba8d013

Please sign in to comment.
Something went wrong with that request. Please try again.