makeConfigManagerWrapper() returns a possibly-NULL ConfigManager into the embedded-JS layer.
Since #674, makeConfigManager() can return NULL. c/configmgr.c:1496 passes
the result straight out as a native pointer without testing it:
static void *makeConfigManagerWrapper(void *userData, EJSNativeInvocation *invocation){
return makeConfigManager();
}
#674 updated simpleMain() and REXXCMGR() for the new contract but not this
one.
NULL is reachable without any z/OS state involvement. configureEmbeddedJS()
has a long-standing failure path -- JS_NewContext() returning null when the
runtime cannot allocate a context -- which frees its argument and returns false.
So this can occur on any platform, most likely when the system is already under
memory pressure.
Suggested: return NULL from the wrapper explicitly and let the JS binding raise,
rather than handing a null native pointer to freeConfigManagerWrapper() and
every method that follows.
Found while reviewing #674, which improves the surrounding code: before it, this
path stored the pointer configureEmbeddedJS() had just freed.
makeConfigManagerWrapper()returns a possibly-NULL ConfigManager into the embedded-JS layer.Since #674,
makeConfigManager()can return NULL.c/configmgr.c:1496passesthe result straight out as a native pointer without testing it:
#674 updated
simpleMain()andREXXCMGR()for the new contract but not thisone.
NULL is reachable without any z/OS state involvement.
configureEmbeddedJS()has a long-standing failure path --
JS_NewContext()returning null when theruntime cannot allocate a context -- which frees its argument and returns false.
So this can occur on any platform, most likely when the system is already under
memory pressure.
Suggested: return NULL from the wrapper explicitly and let the JS binding raise,
rather than handing a null native pointer to
freeConfigManagerWrapper()andevery method that follows.
Found while reviewing #674, which improves the surrounding code: before it, this
path stored the pointer
configureEmbeddedJS()had just freed.