diff options
-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", |