Protect the object destructors agains null pointers on deletion, which

should be something valid.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@534 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez 2010-04-25 00:18:43 +00:00
parent a627df4d10
commit 472cc5a993
13 changed files with 58 additions and 30 deletions

View File

@ -2,6 +2,10 @@
Version 1.8.0 Version 1.8.0
******************************************************************************* *******************************************************************************
2010-03-27 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
Protect the object destructors agains null pointers on deletion, which
should be something valid.
2010-03-27 Marcelo Jimenez <mroberto(at)users.sourceforge.net> 2010-03-27 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
SF Patch Tracker [ 2987390 ] upnp_debug vs. ixml_debug SF Patch Tracker [ 2987390 ] upnp_debug vs. ixml_debug
Thanks for the load of updates, I'm still assimilating them ! Could I make Thanks for the load of updates, I'm still assimilating them ! Could I make

View File

@ -56,6 +56,8 @@ void UpnpActionComplete_delete(UpnpActionComplete *p)
{ {
struct SUpnpActionComplete *q = (struct SUpnpActionComplete *)p; struct SUpnpActionComplete *q = (struct SUpnpActionComplete *)p;
if (!q) return;
q->m_errCode = 0; q->m_errCode = 0;
UpnpString_delete(q->m_ctrlUrl); UpnpString_delete(q->m_ctrlUrl);

View File

@ -62,6 +62,8 @@ void UpnpActionRequest_delete(UpnpActionRequest *p)
{ {
struct SUpnpActionRequest *q = (struct SUpnpActionRequest *)p; struct SUpnpActionRequest *q = (struct SUpnpActionRequest *)p;
if (!q) return;
q->m_errCode = 0; q->m_errCode = 0;
q->m_socket = 0; q->m_socket = 0;

View File

@ -63,6 +63,8 @@ void UpnpDiscovery_delete(UpnpDiscovery *p)
{ {
struct SUpnpDiscovery *q = (struct SUpnpDiscovery *)p; struct SUpnpDiscovery *q = (struct SUpnpDiscovery *)p;
if (!q) return;
q->m_errCode = 0; q->m_errCode = 0;
q->m_expires = 0; q->m_expires = 0;

View File

@ -44,6 +44,8 @@ void UpnpEvent_delete(UpnpEvent *p)
{ {
struct SUpnpEvent *q = (struct SUpnpEvent *)p; struct SUpnpEvent *q = (struct SUpnpEvent *)p;
if (!q) return;
q->m_eventKey = 0; q->m_eventKey = 0;
q->m_changedVariables = NULL; q->m_changedVariables = NULL;

View File

@ -45,6 +45,8 @@ void UpnpEventSubscribe_delete(UpnpEventSubscribe *p)
{ {
struct SEventSubscribe *q = (struct SEventSubscribe *)p; struct SEventSubscribe *q = (struct SEventSubscribe *)p;
if (!q) return;
q->m_errCode = 0; q->m_errCode = 0;
q->m_timeOut = 0; q->m_timeOut = 0;

View File

@ -51,6 +51,8 @@ void UpnpFileInfo_delete(UpnpFileInfo *p)
{ {
struct SUpnpFileInfo *q = (struct SUpnpFileInfo *)p; struct SUpnpFileInfo *q = (struct SUpnpFileInfo *)p;
if (!q) return;
q->m_fileLength = 0; q->m_fileLength = 0;
q->m_lastModified = 0; q->m_lastModified = 0;

View File

@ -49,6 +49,8 @@ void UpnpStateVarComplete_delete(UpnpStateVarComplete *p)
{ {
struct SUpnpStateVarComplete *q = (struct SUpnpStateVarComplete *)p; struct SUpnpStateVarComplete *q = (struct SUpnpStateVarComplete *)p;
if (!q) return;
q->m_errCode = 0; q->m_errCode = 0;
UpnpString_delete(q->m_ctrlUrl); UpnpString_delete(q->m_ctrlUrl);

View File

@ -59,6 +59,8 @@ void UpnpStateVarRequest_delete(UpnpStateVarRequest *p)
{ {
struct SUpnpStateVarRequest *q = (struct SUpnpStateVarRequest *)p; struct SUpnpStateVarRequest *q = (struct SUpnpStateVarRequest *)p;
if (!q) return;
q->m_errCode = 0; q->m_errCode = 0;
q->m_socket = 0; q->m_socket = 0;

View File

@ -43,6 +43,8 @@ void UpnpSubscriptionRequest_delete(UpnpSubscriptionRequest *p)
{ {
struct SUpnpSubscriptionRequest *q = (struct SUpnpSubscriptionRequest *)p; struct SUpnpSubscriptionRequest *q = (struct SUpnpSubscriptionRequest *)p;
if (!q) return;
UpnpString_delete(q->m_serviceId); UpnpString_delete(q->m_serviceId);
q->m_serviceId = NULL; q->m_serviceId = NULL;

View File

@ -74,6 +74,8 @@ void UpnpString_delete(UpnpString *p)
{ {
struct SUpnpString *q = (struct SUpnpString *)p; struct SUpnpString *q = (struct SUpnpString *)p;
if (!q) return;
q->m_length = 0; q->m_length = 0;
free(q->m_string); free(q->m_string);

View File

@ -79,6 +79,8 @@ void UpnpClientSubscription_delete(ClientSubscription *p)
{ {
struct SClientSubscription *q = (struct SClientSubscription *)p; struct SClientSubscription *q = (struct SClientSubscription *)p;
if (!q) return;
q->m_renewEventId = 0; q->m_renewEventId = 0;
UpnpString_delete(q->m_SID); UpnpString_delete(q->m_SID);

View File

@ -1,33 +1,33 @@
/////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// *
// Copyright (c) 2000-2003 Intel Corporation * Copyright (c) 2000-2003 Intel Corporation
// All rights reserved. * All rights reserved.
// *
// Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
// *
// * Redistributions of source code must retain the above copyright notice, * - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, * - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
// * Neither name of Intel Corporation nor the names of its contributors * - Neither name of Intel Corporation nor the names of its contributors
// may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
// without specific prior written permission. * without specific prior written permission.
// *
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// *
/////////////////////////////////////////////////////////////////////////// ******************************************************************************/
/************************************************************************ /************************************************************************
* Purpose: This file contains functions that operate on memory and * Purpose: This file contains functions that operate on memory and
@ -491,6 +491,8 @@ membuffer_delete( INOUT membuffer * m,
assert( m != NULL ); assert( m != NULL );
if (!m) return;
if( m->length == 0 ) { if( m->length == 0 ) {
return; return;
} }