X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fcomstack.c;h=f3f35c24d885044f258a05a077b63557dcfa2961;hp=1755fc721ce985558037ee66f65d156311e672c0;hb=053c92d650501a953d68b228ad74d96b4606eaf6;hpb=afb059d3e508ad4fd38f4a9fd643a4bedf3e0b3f diff --git a/src/comstack.c b/src/comstack.c index 1755fc7..f3f35c2 100644 --- a/src/comstack.c +++ b/src/comstack.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2013 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ /** @@ -87,9 +87,9 @@ void cs_get_host_args(const char *type_and_host, const char **args) } } -static int cs_parse_host(const char *uri, const char **host, - CS_TYPE *t, enum oid_proto *proto, - char **connect_host) +int cs_parse_host(const char *uri, const char **host, + CS_TYPE *t, enum oid_proto *proto, + char **connect_host) { *connect_host = 0; @@ -124,6 +124,8 @@ static int cs_parse_host(const char *uri, const char **host, uri = cp + 1; } #ifdef WIN32 + xfree(*connect_host); + *connect_host = 0; return 0; #else *t = unix_type; @@ -142,6 +144,8 @@ static int cs_parse_host(const char *uri, const char **host, *host = uri + 4; *proto = PROTO_Z3950; #else + xfree(*connect_host); + *connect_host = 0; return 0; #endif } @@ -161,6 +165,8 @@ static int cs_parse_host(const char *uri, const char **host, (*host)++; *proto = PROTO_HTTP; #else + xfree(*connect_host); + *connect_host = 0; return 0; #endif } @@ -187,10 +193,7 @@ COMSTACK cs_create_host_proxy(const char *vhost, int blocking, void **vp, char *connect_host = 0; if (!cs_parse_host(vhost, &host, &t, &proto, &connect_host)) - { - xfree(connect_host); return 0; - } if (proxy_host) { @@ -198,10 +201,7 @@ COMSTACK cs_create_host_proxy(const char *vhost, int blocking, void **vp, xfree(connect_host); if (!cs_parse_host(proxy_host, &host, &t, &proto1, &connect_host)) - { - xfree(connect_host); return 0; - } } if (t == tcpip_type) @@ -427,7 +427,7 @@ static int cs_complete_auto_x(const char *buf, int len, int head_only) int r = cs_complete_http(buf, len, head_only); return r; } - return completeBER((const unsigned char *) buf, len); + return completeBER(buf, len); }