From: des Date: Wed, 23 Jan 2008 16:23:28 +0000 (+0000) Subject: It is possible for VSS_parse() to succeed and return a NULL addr but a X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a86ff46f2d5a77f6285991123344b2deef891303;p=varnish It is possible for VSS_parse() to succeed and return a NULL addr but a non-NULL port (e.g. ":80" which is a valid listening address). In that case, port should be free()d before returning. Coverity Scan (CID:15) git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2379 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/mgt_vcc.c b/varnish-cache/bin/varnishd/mgt_vcc.c index c34ede50..92a7ffc0 100644 --- a/varnish-cache/bin/varnishd/mgt_vcc.c +++ b/varnish-cache/bin/varnishd/mgt_vcc.c @@ -412,6 +412,14 @@ mgt_vcc_default(const char *b_arg, const char *f_arg, int f_fd, int C_flag) * XXX: again: we should check it here in the "trivial" case. */ if (VSS_parse(b_arg, &addr, &port) != 0 || addr == NULL) { + /* + * (addr == NULL && port != NULL) is possible if + * the user incorrectly specified an address such + * as ":80", which is a valid listening address. + * In the future, we may want to interpret this as + * a shortcut for "localhost:80". + */ + free(port); fprintf(stderr, "invalid backend address\n"); return (1); }