diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2015-08-30 16:28:58 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2015-08-30 16:28:58 +0200 |
commit | 64b70c220b1a413e500f2f7e04095cc902d3f7a6 (patch) | |
tree | de20f181ad94296632b5d444fba4d1b97997aa66 | |
parent | 635976a25836e7fd120249a29c7fc70a5e58dc99 (diff) | |
download | cssh-64b70c220b1a413e500f2f7e04095cc902d3f7a6.tar.gz cssh-64b70c220b1a413e500f2f7e04095cc902d3f7a6.tar.bz2 |
fixed some memory problems
-rw-r--r-- | src/cssh.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -68,6 +68,10 @@ static int push_dir_stack( scp_dir_stack_t *stack, const char *dir ) } e->dir = strdup( dir ); + if( e->dir == NULL ) { + free( e ); + return -1; + } e->next = stack->head; stack->head = e; @@ -1091,7 +1095,6 @@ int main( int argc, char *argv[] ) exit( EXIT_FAILURE ); } snprintf( full_path, len, "%s/%s", dir, filename ); - free( dir ); int fd = open( full_path, O_WRONLY | O_CREAT | O_TRUNC, mode ); if( fd < 0 ) { fprintf( stderr, "ERROR: Unable to open file '%s': %s\n", |