Enfore node=NULL on error.

This commit is contained in:
henri 2013-04-22 19:33:37 +00:00
parent 8902a7c1bb
commit 5906c97ff9
2 changed files with 5 additions and 2 deletions

View file

@ -361,7 +361,7 @@ static struct proxy_node *proxy_node_new(char *proxystr) {
pxop = ProxyBackends[i];
if (strncasecmp(proxystr, pxop->prefix, strlen(pxop->prefix)) == 0) {
struct proxy_node *proxy;
struct proxy_node *proxy = NULL;
struct uri uri;
memset(&uri, 0x00, sizeof(struct uri));
@ -369,7 +369,9 @@ static struct proxy_node *proxy_node_new(char *proxystr) {
if (parse_uri(proxystr, &uri) < 0)
break;
pxop->node_new(&proxy, &uri);
if (pxop->node_new(&proxy, &uri) < 0)
proxy = NULL;
uri_free(&uri);
return proxy;

View file

@ -86,6 +86,7 @@ int proxy_http_node_new(struct proxy_node **node, const struct uri *uri) {
if (proxy_resolve(uri->host, (struct sockaddr *)&proxy->ss, &proxy->sslen) < 0) {
free(proxy);
*node = NULL;
return -1;
}