santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vitaly Prapirny <m...@mebius.net>
Subject XML Security C++: Incomplete cleanup in XSECC14n20010315 destructor
Date Wed, 22 Aug 2007 09:52:08 GMT
Hi!

XSECC14n20010315 destructor performs delete [] m_exclNSList[i] but
m_exclNSList items was allocated with strdup and must be released
with free(). And mp_attributes cleanup is absent in code. So I
propose this version of destructor:

XSECC14n20010315::~XSECC14n20010315() {

	if (mp_formatter != NULL)
		delete mp_formatter;

	// Clear out the exclusive namespace list
	int size = (int) m_exclNSList.size();

	for (int i = 0; i < size; ++i) {

		free(m_exclNSList[i]);

	}

	m_exclNSList.clear();

	while (mp_attributes != NULL) {

		mp_currentAttribute = mp_attributes->next;
		delete mp_attributes;
		mp_attributes = mp_currentAttribute;
	}

	mp_attributes = mp_currentAttribute = mp_firstNonNsAttribute = NULL;
}

Good luck!
	Vitaly

Mime
View raw message