[Helix-client-dev] CN-Client : HXPlayer::DoURLOpenFromSource deletes a string, it should not.
David Audrain daudrain at roundbox.comModified by: daudrain at roundbox.com Reviewed by: ehyche at real.com Date: 12:15:2006 Project: client Bug Number: Bug URL: Synopsis: HXPlayer::DoURLOpenFromSource deletes a string, it should not. HXPlayer::DoURLOpenFromSource should delete pszNewURL only if urlType is equal to URL_OPPOSITE_HXSOURCE. Files Added: None Files Modified: client/core/hxplay.cpp Image Size and Heap Use impact (Client -Only): None Platforms and Profiles Affected: win32-i386-vc6 Distribution Libraries Affected: None Distribution library impact and planned action: None Platforms and Profiles Build Verified: win32-i386-vc6 helix-client-all-defines Platforms and Profiles Functionality verified: win32-i386-vc6 helix-client-all-defines Branch: atlas Copyright assignment: My company Roundbox Inc submits this code under the terms of a commercial contribution agreement with RealNetworks, and I am authorized to contribute this code under said agreement. QA Instructions: -- David Audrain Software Engineer Roundbox 9 rue de conde 4 eme Etage 33270 Bordeaux FRANCE www.roundbox.com T: +33 556.001.250 F: +33 556.442.351 E: daudrain at roundbox.com Yahoo: daudrain33 Skype: daudrain33 -------------- next part -------------- Index: hxplay.cpp =================================================================== RCS file: /cvsroot/client/core/hxplay.cpp,v retrieving revision 1.174 diff -u -w -r1.174 hxplay.cpp --- hxplay.cpp 12 Dec 2006 11:01:29 -0000 1.174 +++ hxplay.cpp 13 Dec 2006 17:19:01 -0000 @@ -3076,7 +3076,7 @@ HX_RESULT rc = HXR_OK; HXBOOL bDefault = FALSE; SourceInfo* pSourceInfo = NULL; - const char* pszNewURL = NULL; + CHXString newURL; HXPersistentComponent* pRootPersistentComponent = NULL; HXPersistentComponent* pPersistentComponent = NULL; PersistentType SourceType = PersistentUnknown; @@ -3139,28 +3139,20 @@ switch(urlType) { case URL_ALTERNATE: - pszNewURL = pMainSourceInfo->m_pSource->GetAltURL(bDefault); + newURL = pMainSourceInfo->m_pSource->GetAltURL(bDefault); break; case URL_SDP: - pszNewURL = pMainSourceInfo->m_pSource->GetSDPURL(); + newURL = pMainSourceInfo->m_pSource->GetSDPURL(); break; case URL_REDIRECTED: - pszNewURL = pMainSourceInfo->m_pSource->GetRedirectURL(); + newURL = pMainSourceInfo->m_pSource->GetRedirectURL(); break; case URL_OPPOSITE_HXSOURCE: { const char* pszOldURL = pMainSourceInfo->m_pSource->GetURL(); if (pszOldURL) { - INT32 lOldLen = (INT32) strlen(pszOldURL); - if (lOldLen > 0) - { - pszNewURL = new char [lOldLen + 1]; - if (pszNewURL) - { - strcpy((char*) pszNewURL, pszOldURL); - } - } + newURL = pszOldURL; } } break; @@ -3169,7 +3161,7 @@ break; } - if (!pszNewURL) + if (newURL.IsEmpty()) { rc = HXR_UNEXPECTED; goto cleanup; @@ -3180,7 +3172,7 @@ HX_DELETE(m_pURL); - m_pURL = new CHXURL(pszNewURL, (IHXClientEngine*)m_pEngine); + m_pURL = new CHXURL(newURL, (IHXClientEngine*)m_pEngine); if( m_pURL ) { rc = m_pURL->GetLastError(); @@ -3230,7 +3222,6 @@ m_bPartOfNextGroup = FALSE; HX_DELETE(pMainSourceInfo); - HX_VECTOR_DELETE(pszNewURL); SchedulePlayer(PLAYER_SCHEDULE_DEFAULT | PLAYER_SCHEDULE_IMMEDIATE | PLAYER_SCHEDULE_RESET); }