diff --git a/scp.c b/scp.c index f1926bc4..e377eba6 100644 --- a/scp.c +++ b/scp.c @@ -3390,7 +3390,9 @@ if (dir) { char FileName[PATH_MAX + 1], *MatchName; char *c; struct tm *local; +#if defined (HAVE_GLOB) int i; +#endif MatchName = 1 + strrchr (cptr, '/'); printf (" Directory of %s\n\n", DirName[0] ? DirName : "/"); @@ -7959,6 +7961,7 @@ t_stat scp_vhelpFromFile (FILE *st, struct sim_device *dptr, #define XPANDQ 512 p = (char *) realloc (help, ((size_t)size) + XPANDQ +1); if (!p) { + free (help); fclose (fp); return SCPE_MEM; } diff --git a/sim_sock.c b/sim_sock.c index 986e70e0..46060084 100644 --- a/sim_sock.c +++ b/sim_sock.c @@ -334,7 +334,7 @@ else { fixed[1] = NULL; ips = fixed; } -for (ip=ips; *ip != NULL; ++ip) { +for (ip=ips; (ip != NULL) && (*ip != NULL); ++ip) { ai = (struct addrinfo *)calloc(1, sizeof(*ai)); if (NULL == ai) { s_freeaddrinfo(result); @@ -556,7 +556,7 @@ if ((host != NULL) && (host_len != 0)) if ((port != NULL) && (port_len != 0)) memset (port, 0, port_len); if ((cptr == NULL) || (*cptr == 0)) { - if (((default_host == NULL) || (*default_host == 0)) && ((default_port == NULL) || (*default_port == 0))) + if (((default_host == NULL) || (*default_host == 0)) || ((default_port == NULL) || (*default_port == 0))) return SCPE_ARG; if ((strlen(default_host) >= host_len) || (strlen(default_port) >= port_len)) return SCPE_ARG; /* no room */