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:
parent
1d94ab95c5
commit
9d5bbc8090
12
db/db.vcproj
12
db/db.vcproj
@ -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>
|
||||
|
@ -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 );
|
||||
|
3
stdafx.h
3
stdafx.h
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user