X-Git-Url: http://sjero.net/git/?a=blobdiff_plain;f=src%2Finit.c;h=321f50d4bf7d63ada9e695b2f6f898c6e989acda;hb=07f60f19a4ee99ddc343bb51568b0c474e9b853d;hp=64218de7af5c54b2d7497bad1a1b38d74ab01de9;hpb=7828e81c7905a8e9b864c7e386c9ebadcb474b82;p=wget diff --git a/src/init.c b/src/init.c index 64218de7..321f50d4 100644 --- a/src/init.c +++ b/src/init.c @@ -161,6 +161,10 @@ static struct { { "simplehostcheck", &opt.simple_check, cmd_boolean }, { "spanhosts", &opt.spanhost, cmd_boolean }, { "spider", &opt.spider, cmd_boolean }, +#ifdef HAVE_SSL + { "sslcertfile", &opt.sslcertfile, cmd_string }, + { "sslcertkey", &opt.sslcertkey, cmd_string }, +#endif /* HAVE_SSL */ { "timeout", &opt.timeout, cmd_time }, { "timestamping", &opt.timestamping, cmd_boolean }, { "tries", &opt.ntry, cmd_number_inf }, @@ -493,28 +497,21 @@ static int myatoi PARAMS ((const char *s)); static int cmd_address (const char *com, const char *val, void *closure) { - struct sockaddr_in *sin; - - sin = (struct sockaddr_in *) malloc(sizeof *sin); - if (sin == NULL) - { - fprintf (stderr, _("%s: Out of memory.\n"), exec_name); - return 0; - } - - if (!store_hostaddress ((unsigned char *)&sin->sin_addr, val)) + struct sockaddr_in sin; + + if (!store_hostaddress ((unsigned char *)&sin.sin_addr, val)) { - fprintf (stderr, _("%s: %s: Cannot convert `%s' to an IP address.\n"), - exec_name, com, val); - return 0; + fprintf (stderr, _("%s: %s: Cannot convert `%s' to an IP address.\n"), + exec_name, com, val); + return 0; } - - sin->sin_family = AF_INET; - sin->sin_port = 0; - - * (struct sockaddr_in **) closure = sin; - - return 1; + + sin.sin_family = AF_INET; + sin.sin_port = 0; + + memcpy (closure, &sin, sizeof (sin)); + + return 1; } /* Store the boolean value from VAL to CLOSURE. COM is ignored, @@ -1021,4 +1018,8 @@ cleanup (void) FREE_MAYBE (opt.http_user); FREE_MAYBE (opt.http_passwd); FREE_MAYBE (opt.user_header); +#ifdef HAVE_SSL + FREE_MAYBE (opt.sslcertkey); + FREE_MAYBE (opt.sslcertfile); +#endif /* HAVE_SSL */ }