diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-10-22 18:56:02 +0200 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-10-22 18:56:02 +0200 |
commit | 840cecbe0e68bc71c0afea4b3d79bd5702d403d0 (patch) | |
tree | 1da69bd40a3b37e02145ee994de90e1a90bb56e3 | |
parent | 27d25752e93c19d3e6584915bd64b72e43f3afc0 (diff) | |
download | libssh-840cecbe0e68bc71c0afea4b3d79bd5702d403d0.tar.gz libssh-840cecbe0e68bc71c0afea4b3d79bd5702d403d0.tar.xz libssh-840cecbe0e68bc71c0afea4b3d79bd5702d403d0.zip |
Fix memory leaks in ssh_bind_options_set() if called twice.
This fixes ticket #36.
-rw-r--r-- | libssh/options.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libssh/options.c b/libssh/options.c index 46d822f3..e4b2027c 100644 --- a/libssh/options.c +++ b/libssh/options.c @@ -684,6 +684,7 @@ int ssh_bind_options_set(ssh_bind sshbind, enum ssh_bind_options_e type, ssh_set_error_invalid(sshbind, __FUNCTION__); return -1; } else { + SAFE_FREE(sshbind->bindaddr); sshbind->bindaddr = strdup(value); if (sshbind->bindaddr == NULL) { ssh_set_error_oom(sshbind); @@ -762,6 +763,7 @@ int ssh_bind_options_set(ssh_bind sshbind, enum ssh_bind_options_e type, ssh_set_error_invalid(sshbind, __FUNCTION__); return -1; } else { + SAFE_FREE(sshbind->rsakey); sshbind->rsakey = strdup(value); if (sshbind->rsakey == NULL) { ssh_set_error_oom(sshbind); @@ -774,6 +776,7 @@ int ssh_bind_options_set(ssh_bind sshbind, enum ssh_bind_options_e type, ssh_set_error_invalid(sshbind, __FUNCTION__); return -1; } else { + SAFE_FREE(sshbind->banner); sshbind->banner = strdup(value); if (sshbind->banner == NULL) { ssh_set_error_oom(sshbind); |