summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2015-08-30 16:28:58 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2015-08-30 16:28:58 +0200
commit64b70c220b1a413e500f2f7e04095cc902d3f7a6 (patch)
treede20f181ad94296632b5d444fba4d1b97997aa66
parent635976a25836e7fd120249a29c7fc70a5e58dc99 (diff)
downloadcssh-64b70c220b1a413e500f2f7e04095cc902d3f7a6.tar.gz
cssh-64b70c220b1a413e500f2f7e04095cc902d3f7a6.tar.bz2
fixed some memory problems
-rw-r--r--src/cssh.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cssh.c b/src/cssh.c
index 66272ef..bd53804 100644
--- a/src/cssh.c
+++ b/src/cssh.c
@@ -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",