Reverting previous commit, fixing more resource leaks

This commit is contained in:
plutoo 2014-12-15 01:43:18 +01:00
parent a3febb5fe1
commit a720cb6e49

View File

@ -36,10 +36,14 @@ Result httpcOpenContext(httpcContext *context, char* url, u32 use_defaultproxy)
if(ret!=0)return ret; if(ret!=0)return ret;
ret = srvGetServiceHandle(&context->servhandle, "http:C"); ret = srvGetServiceHandle(&context->servhandle, "http:C");
if(ret!=0)return ret; if(ret!=0) {
HTTPC_CloseContext(__httpc_servhandle, context->httphandle);
return ret;
}
ret = HTTPC_InitializeConnectionSession(context->servhandle, context->httphandle); ret = HTTPC_InitializeConnectionSession(context->servhandle, context->httphandle);
if(ret!=0) { if(ret!=0) {
HTTPC_CloseContext(__httpc_servhandle, context->httphandle);
svcCloseHandle(context->servhandle); svcCloseHandle(context->servhandle);
return ret; return ret;
} }
@ -48,6 +52,7 @@ Result httpcOpenContext(httpcContext *context, char* url, u32 use_defaultproxy)
ret = HTTPC_SetProxyDefault(context->servhandle, context->httphandle); ret = HTTPC_SetProxyDefault(context->servhandle, context->httphandle);
if(ret!=0) { if(ret!=0) {
HTTPC_CloseContext(__httpc_servhandle, context->httphandle);
svcCloseHandle(context->servhandle); svcCloseHandle(context->servhandle);
return ret; return ret;
} }
@ -59,7 +64,7 @@ Result httpcCloseContext(httpcContext *context)
{ {
Result ret=0; Result ret=0;
ret = HTTPC_CloseContext(__httpc_servhandle, context->httphandle); ret = HTTPC_CloseContext(context->servhandle, context->httphandle);
svcCloseHandle(context->servhandle); svcCloseHandle(context->servhandle);
return ret; return ret;