diff --git a/db/db.vcproj b/db/db.vcproj
index b78d0e03781..a5392ade05d 100644
--- a/db/db.vcproj
+++ b/db/db.vcproj
@@ -1773,6 +1773,18 @@
RelativePath="..\scripting\engine_spidermonkey.cpp"
>
+
+
+
+
+
diff --git a/scripting/engine_spidermonkey.cpp b/scripting/engine_spidermonkey.cpp
index a1eca14ef48..ae2dad81441 100644
--- a/scripting/engine_spidermonkey.cpp
+++ b/scripting/engine_spidermonkey.cpp
@@ -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 );
diff --git a/stdafx.h b/stdafx.h
index 8d412fcebde..4269eda3900 100644
--- a/stdafx.h
+++ b/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