diff --git a/src/UPnP.cpp b/src/UPnP.cpp
index 0e7d5b2..fd661d4 100644
--- a/src/UPnP.cpp
+++ b/src/UPnP.cpp
@@ -672,49 +672,68 @@ m_SCPD(NULL)
 {
 	std::ostringstream msg;
 	int errcode;
-	
-	char *scpdURL = new char[URLBase.length() + m_SCPDURL.length() + 1];
+
+	// to avoid memory leaks and to use only one buffer instead of
+	// thre different buffers we'll use only one statically declared
+	// buffer instead of three different buffers dinamically allocated
+	//
+	unsigned int commonBufferLen; // dimension for common buffer
+
+	// calculate dimension for common buffer
+	commonBufferLen = std::max(m_SCPDURL.length(),
+		std::max(m_controlURL.length(), m_eventSubURL.length()));
+	commonBufferLen += (URLBase.length() + 1);
+
+	// OK, now we can declare commonBuffer
+	char commonBuffer[commonBufferLen];
+
+	// probabbly the following is unuseful (just to be sure...)
+	memset(commonBuffer, 0x0, commonBufferLen);
+
+	// and now let's use it! 
 	errcode = upnpLib.m_UpnpResolveURL(
 		URLBase.c_str(),
 		m_SCPDURL.c_str(),
-		scpdURL);
+		commonBuffer);
 	if( errcode != UPNP_E_SUCCESS ) {
 		msg << "Error generating scpdURL from " <<
 			"|" << URLBase << "|" <<
 			m_SCPDURL << "|.";
 		AddDebugLogLineM(false, logUPnP, msg);
 	} else {
-		m_absSCPDURL = scpdURL;
+		m_absSCPDURL = commonBuffer;
 	}
 
-	char *controlURL = new char[
-		URLBase.length() + m_controlURL.length() + 1];
+	// probabbly the following is unuseful (just to be sure...)
+	memset(commonBuffer, 0x0, commonBufferLen);
+
 	errcode = upnpLib.m_UpnpResolveURL(
 		URLBase.c_str(),
 		m_controlURL.c_str(),
-		controlURL);
+		commonBuffer);
 	if( errcode != UPNP_E_SUCCESS ) {
 		msg << "Error generating controlURL from " <<
 			"|" << URLBase << "|" <<
 			m_controlURL << "|.";
 		AddDebugLogLineM(false, logUPnP, msg);
 	} else {
-		m_absControlURL = controlURL;
+		m_absControlURL = commonBuffer;
 	}
 
-	char *eventURL = new char[
-		URLBase.length() + m_eventSubURL.length() + 1];
+	// probabbly the following is unuseful (just to be sure...)
+	memset(commonBuffer, 0x0, commonBufferLen);
+
 	errcode = upnpLib.m_UpnpResolveURL(
 		URLBase.c_str(),
 		m_eventSubURL.c_str(),
-		eventURL);
+		commonBuffer);
 	if( errcode != UPNP_E_SUCCESS ) {
 		msg << "Error generating eventURL from " <<
 			"|" << URLBase << "|" <<
 			m_eventSubURL << "|.";
 		AddDebugLogLineM(false, logUPnP, msg);
 	} else {
-		m_absEventSubURL = eventURL;
+		m_absEventSubURL = commonBuffer;
 	}
 
 	msg <<	"\n    Service:"             <<
