X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/498c3570ae00dea1f54fb067e1d2c27435863e90..2fd4c9a9c613326eda6b0837e3bc73fc6210f258:/Library.cpp diff --git a/Library.cpp b/Library.cpp index bc16967..7a87368 100644 --- a/Library.cpp +++ b/Library.cpp @@ -588,6 +588,7 @@ const char *CYPoolCCYON(apr_pool_t *pool, JSContextRef context, JSObjectRef obje JSValueRef toCYON(CYGetProperty(context, object, toCYON_s)); if (CYIsCallable(context, toCYON)) { JSValueRef value(CYCallAsFunction(context, (JSObjectRef) toCYON, object, 0, NULL)); + _assert(value != NULL); return CYPoolCString(pool, context, value); } @@ -881,7 +882,10 @@ Closure_privateData *CYMakeFunctor_(JSContextRef context, JSObjectRef function, static JSObjectRef CYMakeFunctor(JSContextRef context, JSObjectRef function, const char *type) { Closure_privateData *internal(CYMakeFunctor_(context, function, type, &FunctionClosure_)); - return JSObjectMake(context, Functor_, internal); + JSObjectRef object(JSObjectMake(context, Functor_, internal)); + // XXX: see above notes about needing to leak + JSValueProtect(CYGetJSContext(context), object); + return object; } JSObjectRef CYGetCachedObject(JSContextRef context, JSStringRef name) {