Skip to content
This repository
Browse code

Fix memory leak and a failed ASSERT under win32 Debug build. A string…

… was being double-strdup'ed, causing delete[] to fail when deleting the copy from the different heap instead of the local one.

Tracking down the assert to dbgheap.c gives the following message:
> a bad pointer has been passed in. It may be totally bogus, or it may have been allocated from another heap. The pointer MUST come from the 'local' heap.
  • Loading branch information...
commit 98a74f45f304f4aaf0fca51d2901a5d2fa086c5c 1 parent 64a0e61
Garrett Brown authored June 27, 2013
3  lib/addons/library.xbmc.addon/libXBMC_addon.cpp
@@ -113,8 +113,7 @@ DLLEXPORT char* XBMC_get_dvd_menu_language(void *hdl, void* cb)
113 113
   if (cb == NULL)
114 114
     return "";
115 115
 
116  
-  string buffer = ((CB_AddOnLib*)cb)->GetDVDMenuLanguage(((AddonCB*)hdl)->addonData);
117  
-  return strdup(buffer.c_str());
  116
+  return ((CB_AddOnLib*)cb)->GetDVDMenuLanguage(((AddonCB*)hdl)->addonData);
118 117
 }
119 118
 
120 119
 DLLEXPORT void XBMC_free_string(void* hdl, void* cb, char* str)

0 notes on commit 98a74f4

Please sign in to comment.
Something went wrong with that request. Please try again.