diff --git a/src/mod_process.c b/src/mod_process.c index 775b3ac7..16975623 100644 --- a/src/mod_process.c +++ b/src/mod_process.c @@ -290,14 +290,14 @@ static JSValue tjs_spawn(JSContext *ctx, JSValue this_val, int argc, JSValue *ar } options.env = js_mallocz(ctx, sizeof(*options.env) * (plen + 1)); if (!options.env) { - JS_FreePropEnum(ctx, ptab, plen); + JS_FreePropertyEnum(ctx, ptab, plen); JS_FreeValue(ctx, js_env); goto fail; } for (int i = 0; i < plen; i++) { JSValue prop = JS_GetProperty(ctx, js_env, ptab[i].atom); if (JS_IsException(prop)) { - JS_FreePropEnum(ctx, ptab, plen); + JS_FreePropertyEnum(ctx, ptab, plen); JS_FreeValue(ctx, js_env); goto fail; } @@ -309,7 +309,7 @@ static JSValue tjs_spawn(JSContext *ctx, JSValue this_val, int argc, JSValue *ar if (!options.env[i]) { JS_FreeCString(ctx, key); JS_FreeCString(ctx, value); - JS_FreePropEnum(ctx, ptab, plen); + JS_FreePropertyEnum(ctx, ptab, plen); JS_FreeValue(ctx, js_env); goto fail; } @@ -317,7 +317,7 @@ static JSValue tjs_spawn(JSContext *ctx, JSValue this_val, int argc, JSValue *ar JS_FreeCString(ctx, key); JS_FreeCString(ctx, value); } - JS_FreePropEnum(ctx, ptab, plen); + JS_FreePropertyEnum(ctx, ptab, plen); } JS_FreeValue(ctx, js_env); diff --git a/src/mod_sqlite3.c b/src/mod_sqlite3.c index 8967e143..cfae5477 100644 --- a/src/mod_sqlite3.c +++ b/src/mod_sqlite3.c @@ -483,7 +483,7 @@ static JSValue tjs__sqlite3_bind_params(JSContext *ctx, sqlite3_stmt *stmt, JSVa JSAtom patom = ptab[i].atom; JSValue prop = JS_GetProperty(ctx, params, patom); if (JS_IsException(prop)) { - JS_FreePropEnum(ctx, ptab, plen); + JS_FreePropertyEnum(ctx, ptab, plen); return JS_EXCEPTION; } const char *key = JS_AtomToCString(ctx, patom); @@ -494,13 +494,13 @@ static JSValue tjs__sqlite3_bind_params(JSContext *ctx, sqlite3_stmt *stmt, JSVa } JS_FreeValue(ctx, prop); JS_FreeCString(ctx, key); - JS_FreePropEnum(ctx, ptab, plen); + JS_FreePropertyEnum(ctx, ptab, plen); return JS_EXCEPTION; } JS_FreeValue(ctx, prop); JS_FreeCString(ctx, key); } - JS_FreePropEnum(ctx, ptab, plen); + JS_FreePropertyEnum(ctx, ptab, plen); } else { return JS_ThrowTypeError(ctx, "Invalid bind parameters type: expected object or array"); } diff --git a/src/utils.c b/src/utils.c index 22da2b34..90d4f3dc 100644 --- a/src/utils.c +++ b/src/utils.c @@ -172,16 +172,6 @@ void tjs_call_handler(JSContext *ctx, JSValue func, int argc, JSValue *argv) { JS_FreeValue(ctx, ret); } -void JS_FreePropEnum(JSContext *ctx, JSPropertyEnum *tab, uint32_t len) { - uint32_t i; - if (tab) { - for (i = 0; i < len; i++) { - JS_FreeAtom(ctx, tab[i].atom); - } - js_free(ctx, tab); - } -} - JSValue TJS_InitPromise(JSContext *ctx, TJSPromise *p) { JSValue rfuncs[2]; p->p = JS_NewPromiseCapability(ctx, rfuncs); diff --git a/src/utils.h b/src/utils.h index a0416ad3..a01c3767 100644 --- a/src/utils.h +++ b/src/utils.h @@ -106,7 +106,6 @@ void tjs_addr2obj(JSContext *ctx, JSValue obj, const struct sockaddr *sa, bool s void tjs_call_handler(JSContext *ctx, JSValue func, int argc, JSValue *argv); void tjs_dump_error(JSContext *ctx); void tjs_dump_error1(JSContext *ctx, JSValue exception_val); -void JS_FreePropEnum(JSContext *ctx, JSPropertyEnum *tab, uint32_t len); typedef struct { JSValue p;