From 8f78a760cf2ad5366f7638f86c64550e4299baaf Mon Sep 17 00:00:00 2001 From: Dan Witte Date: Wed, 5 May 2010 12:01:28 -0700 Subject: [PATCH] Address review comment from bug 551982. r=benjamn --- js/src/ctypes/CTypes.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 1a8c21e402f..36cd2df0209 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -3944,9 +3944,8 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj, JSObject* fieldsObj return JS_FALSE; // Create a hash of FieldInfo objects to stash on the type object. - FieldInfoHash* fields(new FieldInfoHash); + AutoPtr fields(new FieldInfoHash); if (!fields || !fields->init(len)) { - delete fields; JS_ReportOutOfMemory(cx); return JS_FALSE; } @@ -3954,8 +3953,9 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj, JSObject* fieldsObj // Stash the FieldInfo hash in a reserved slot now, for GC safety of its // constituents. if (!JS_SetReservedSlot(cx, typeObj, SLOT_FIELDINFO, - PRIVATE_TO_JSVAL(fields))) + PRIVATE_TO_JSVAL(fields.get()))) return JS_FALSE; + fields.forget(); // Process the field types. size_t structSize, structAlign;