From: Zdeněk Salvet Date: Wed, 10 Mar 2010 14:55:36 +0000 (+0000) Subject: Fix filedescriptor leak in glite_gsplugin_accept(). X-Git-Tag: merge_20_2_dst~27 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=2edaa676dafc6f99879ba7cc977498d1fb24ad70;p=jra1mw.git Fix filedescriptor leak in glite_gsplugin_accept(). --- diff --git a/org.glite.security.gsoap-plugin/src/glite_gsplugin.c b/org.glite.security.gsoap-plugin/src/glite_gsplugin.c index 73bc35e..ca8852b 100644 --- a/org.glite.security.gsoap-plugin/src/glite_gsplugin.c +++ b/org.glite.security.gsoap-plugin/src/glite_gsplugin.c @@ -367,6 +367,7 @@ glite_gsplugin_accept(struct soap *soap, int s, struct sockaddr *a, int *n) if ( (conn = accept(s, (struct sockaddr *)&a, (socklen_t *)n)) < 0 ) return conn; if ( !ctx->connection ) { if ( !(ctx->connection = (edg_wll_GssConnection *)malloc(sizeof(*ctx->connection))) ) { + close(conn); soap_set_receiver_error(soap, "malloc error", strerror(ENOMEM), ENOMEM); return SOAP_INVALID_SOCKET; } @@ -374,6 +375,7 @@ glite_gsplugin_accept(struct soap *soap, int s, struct sockaddr *a, int *n) } if ( edg_wll_gss_accept(ctx->cred, conn, ctx->timeout, ctx->connection, &gss_code)) { pdprintf(("GSLITE_GSPLUGIN: Client authentication failed, closing.\n")); + close(conn); edg_wll_gss_get_error(&gss_code, "Client authentication failed", &ctx->error_msg); soap->errnum = SOAP_SVR_FAULT; soap_set_receiver_error(soap, "SSL error", "SSL authentication failed in tcp_connect(): check password, key file, and ca file.", SOAP_SSL_ERROR);