Previously, the joined string was freed with the JSContext passed as
the pool argument of the chain free function. This only worked for
chains initialized with NJS_CHB_CTX_INIT(), where the pool is the
context itself.
Now, the chain pool is used, so the function works with chains using
any allocator. No functional changes for existing callers.
val = JS_NewStringLen(cx, (const char *) str.start, str.length);
- chain->free(cx, str.start);
+ chain->free(chain->pool, str.start);
return val;
}