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 963b706aa..6c0511519 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"
@@ -256,12 +256,14 @@ clear_forwardings(Options *options)
256 int i; 256 int i;
257 257
258 for (i = 0; i < options->num_local_forwards; i++) { 258 for (i = 0; i < options->num_local_forwards; i++) {
259 xfree(options->local_forwards[i].listen_host); 259 if (options->local_forwards[i].listen_host != NULL)
260 xfree(options->local_forwards[i].listen_host);
260 xfree(options->local_forwards[i].connect_host); 261 xfree(options->local_forwards[i].connect_host);
261 } 262 }
262 options->num_local_forwards = 0; 263 options->num_local_forwards = 0;
263 for (i = 0; i < options->num_remote_forwards; i++) { 264 for (i = 0; i < options->num_remote_forwards; i++) {
264 xfree(options->remote_forwards[i].listen_host); 265 if (options->remote_forwards[i].listen_host != NULL)
266 xfree(options->remote_forwards[i].listen_host);
265 xfree(options->remote_forwards[i].connect_host); 267 xfree(options->remote_forwards[i].connect_host);
266 } 268 }
267 options->num_remote_forwards = 0; 269 options->num_remote_forwards = 0;
@@ -302,7 +304,7 @@ process_config_line(Options *options, const char *host,
302 Forward fwd; 304 Forward fwd;
303 305
304 /* Strip trailing whitespace */ 306 /* Strip trailing whitespace */
305 for(len = strlen(line) - 1; len > 0; len--) { 307 for (len = strlen(line) - 1; len > 0; len--) {
306 if (strchr(WHITESPACE, line[len]) == NULL) 308 if (strchr(WHITESPACE, line[len]) == NULL)
307 break; 309 break;
308 line[len] = '\0'; 310 line[len] = '\0';