summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/readconf.c b/readconf.c
index 7173a8c23..8ace1bbd4 100644
--- a/readconf.c
+++ b/readconf.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: readconf.c,v 1.137 2005/03/04 08:48:06 djm Exp $"); 15RCSID("$OpenBSD: readconf.c,v 1.139 2005/03/10 22:01:05 deraadt Exp $");
16 16
17#include "ssh.h" 17#include "ssh.h"
18#include "xmalloc.h" 18#include "xmalloc.h"
@@ -253,12 +253,14 @@ clear_forwardings(Options *options)
253 int i; 253 int i;
254 254
255 for (i = 0; i < options->num_local_forwards; i++) { 255 for (i = 0; i < options->num_local_forwards; i++) {
256 xfree(options->local_forwards[i].listen_host); 256 if (options->local_forwards[i].listen_host != NULL)
257 xfree(options->local_forwards[i].listen_host);
257 xfree(options->local_forwards[i].connect_host); 258 xfree(options->local_forwards[i].connect_host);
258 } 259 }
259 options->num_local_forwards = 0; 260 options->num_local_forwards = 0;
260 for (i = 0; i < options->num_remote_forwards; i++) { 261 for (i = 0; i < options->num_remote_forwards; i++) {
261 xfree(options->remote_forwards[i].listen_host); 262 if (options->remote_forwards[i].listen_host != NULL)
263 xfree(options->remote_forwards[i].listen_host);
262 xfree(options->remote_forwards[i].connect_host); 264 xfree(options->remote_forwards[i].connect_host);
263 } 265 }
264 options->num_remote_forwards = 0; 266 options->num_remote_forwards = 0;
@@ -299,7 +301,7 @@ process_config_line(Options *options, const char *host,
299 Forward fwd; 301 Forward fwd;
300 302
301 /* Strip trailing whitespace */ 303 /* Strip trailing whitespace */
302 for(len = strlen(line) - 1; len > 0; len--) { 304 for (len = strlen(line) - 1; len > 0; len--) {
303 if (strchr(WHITESPACE, line[len]) == NULL) 305 if (strchr(WHITESPACE, line[len]) == NULL)
304 break; 306 break;
305 line[len] = '\0'; 307 line[len] = '\0';