0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00

fix up free() old defensive code

This commit is contained in:
Dwight 2009-05-13 11:42:48 -04:00
parent 1d94ab95c5
commit 9d5bbc8090
3 changed files with 17 additions and 0 deletions

View File

@ -1773,6 +1773,18 @@
RelativePath="..\scripting\engine_spidermonkey.cpp"
>
</File>
<File
RelativePath="..\shell\mongo_vstudio.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>

View File

@ -75,6 +75,8 @@ namespace mongo {
string toString( JSString * so ){
jschar * s = JS_GetStringChars( so );
size_t srclen = JS_GetStringLength( so );
if( srclen == 0 )
return "";
size_t len = srclen * 2;
char * dst = (char*)malloc( len );

View File

@ -315,8 +315,11 @@ namespace mongo {
#if defined(_WIN32)
#define strcasecmp _stricmp
inline void our_debug_free(void *p) {
#if 0
// this is not safe if you malloc < 4 bytes so we don't use anymore
unsigned *u = (unsigned *) p;
u[0] = 0xEEEEEEEE;
#endif
free(p);
}
#define free our_debug_free