Merge branch 'master' of git://github.com/mrjimenez/pupnp

This commit is contained in:
Thijs Schreijer 2012-10-14 08:33:19 +02:00
commit 2a0d73aeac
6 changed files with 26 additions and 15 deletions

View File

@ -332,6 +332,13 @@ Version 1.8.0
Version 1.6.18
*******************************************************************************
2012-06-19 Yoichi NAKAYAMA <yoichi.nakayama(at)gmail.com>
Fix memory leak and access violation in UpnpSendAction(Ex)Async.
Free buffers after malloc or ixmlPrintNode failure.
Free Param->Header before destructing Param.
2012-05-25 Anoop Mohan <anoop.anoop(at)gmail.com>
This patch fixes a bug in non blocking connect call where the sock

View File

@ -2769,6 +2769,7 @@ int UpnpSendActionAsync(
malloc( sizeof( struct UpnpNonblockParam ) );
if( Param == NULL ) {
ixmlFreeDOMString( tmpStr );
return UPNP_E_OUTOF_MEMORY;
}
memset( Param, 0, sizeof( struct UpnpNonblockParam ) );
@ -2862,6 +2863,7 @@ int UpnpSendActionExAsync(
tmpStr = ixmlPrintNode( ( IXML_Node * ) Act );
if( tmpStr == NULL ) {
ixmlFreeDOMString( headerStr );
return UPNP_E_INVALID_ACTION;
}
@ -2869,6 +2871,8 @@ int UpnpSendActionExAsync(
( struct UpnpNonblockParam * )
malloc( sizeof( struct UpnpNonblockParam ) );
if( Param == NULL ) {
ixmlFreeDOMString( tmpStr );
ixmlFreeDOMString( headerStr );
return UPNP_E_OUTOF_MEMORY;
}
memset( Param, 0, sizeof( struct UpnpNonblockParam ) );
@ -2892,10 +2896,10 @@ int UpnpSendActionExAsync(
retVal = ixmlParseBufferEx( tmpStr, &( Param->Act ) );
if( retVal != IXML_SUCCESS ) {
ixmlDocument_free( Param->Header );
free( Param );
ixmlFreeDOMString( tmpStr );
ixmlFreeDOMString( headerStr );
ixmlDocument_free( Param->Header );
if( retVal == IXML_INSUFFICIENT_MEMORY ) {
return UPNP_E_OUTOF_MEMORY;
} else {

View File

@ -257,14 +257,11 @@ static int genaNotify(
{
size_t i;
membuffer mid_msg;
membuffer endmsg;
uri_type *url;
http_parser_t response;
int return_code = -1;
membuffer_init(&mid_msg);
/* make 'end' msg (the part that won't vary with the destination) */
endmsg.size_inc = 30;
if (http_MakeMessage(&mid_msg, 1, 1,
"s" "ssc" "sdcc",
headers,

View File

@ -502,10 +502,14 @@ static int get_miniserver_sockets(
MiniServerSockArray *out,
/*! [in] port on which the server is listening for incoming IPv4
* connections. */
uint16_t listen_port4,
uint16_t listen_port4
#ifdef UPNP_ENABLE_IPV6
,
/*! [in] port on which the server is listening for incoming IPv6
* connections. */
uint16_t listen_port6)
uint16_t listen_port6
#endif
)
{
char errorBuffer[ERROR_BUFFER_LEN];
struct sockaddr_storage __ss_v4;
@ -760,10 +764,6 @@ static int get_miniserver_sockets(
out->miniServerSock4 = listenfd4;
#ifdef UPNP_ENABLE_IPV6
out->miniServerSock6 = listenfd6;
#else
/* Silence compiler warning message:
* warning: unused parameter listen_port6 */
listen_port6 = 0u;
#endif
return UPNP_E_SUCCESS;
}
@ -868,7 +868,11 @@ int StartMiniServer(
#ifdef INTERNAL_WEB_SERVER
/* V4 and V6 http listeners. */
ret_code = get_miniserver_sockets(
miniSocket, *listen_port4, *listen_port6);
miniSocket, *listen_port4
#ifdef UPNP_ENABLE_IPV6
, *listen_port6
#endif
);
if (ret_code != UPNP_E_SUCCESS) {
free(miniSocket);
return ret_code;

View File

@ -493,8 +493,6 @@ int web_server_init()
void web_server_destroy(void)
{
int ret;
if (bWebServerState == WEB_SERVER_ENABLED) {
membuffer_destroy(&gDocumentRootDir);
alias_release(&gAliasDoc);
@ -503,8 +501,7 @@ void web_server_destroy(void)
memset(&gAliasDoc, 0, sizeof(struct xml_alias_t));
ithread_mutex_unlock(&gWebMutex);
ret = ithread_mutex_destroy(&gWebMutex);
assert(ret == 0);
ithread_mutex_destroy(&gWebMutex);
bWebServerState = WEB_SERVER_DISABLED;
}
}

View File

@ -186,7 +186,9 @@ static int NewRequestHandler(
unsigned long replyAddr = inet_addr(gIF_IPV4);
/* a/c to UPNP Spec */
int ttl = 4;
#ifdef INET_IPV6
int hops = 1;
#endif
char buf_ntop[INET6_ADDRSTRLEN];
int ret = UPNP_E_SUCCESS;