mirror of
https://github.com/Ylianst/MeshAgent
synced 2026-01-03 00:53:41 +00:00
Fixed valgrind issue
This commit is contained in:
@@ -679,7 +679,7 @@ void* ILibDuktape_Timeout(duk_context *ctx, void **args, int argsLen, int delay,
|
||||
duk_push_pointer(ctx, callback); // [setTimeout][this][func][delay][userFunc]
|
||||
duk_push_array(ctx); // [setTimeout][this][func][delay][userFunc][array]
|
||||
|
||||
while (args[i] != NULL && i < argsLen)
|
||||
while (i < argsLen && args[i] != NULL)
|
||||
{
|
||||
duk_get_prop_string(ctx, -1, "push"); // [setInterval][this][func][delay][userFunc][array][push]
|
||||
duk_dup(ctx, -2); // [setInterval][this][func][delay][userFunc][array][push][this]
|
||||
|
||||
@@ -279,7 +279,7 @@ duk_ret_t ILibDuktape_Polyfills_Buffer_toString(duk_context *ctx)
|
||||
{
|
||||
int nargs = duk_get_top(ctx);
|
||||
char *buffer, *tmpBuffer;
|
||||
duk_size_t bufferLen;
|
||||
duk_size_t bufferLen = 0;
|
||||
char *cType;
|
||||
|
||||
duk_push_this(ctx); // [buffer]
|
||||
@@ -287,8 +287,15 @@ duk_ret_t ILibDuktape_Polyfills_Buffer_toString(duk_context *ctx)
|
||||
|
||||
if (nargs == 0)
|
||||
{
|
||||
// Just convert to a string
|
||||
duk_push_lstring(ctx, buffer, strnlen_s(buffer, bufferLen)); // [buffer][string]
|
||||
if (bufferLen == 0 || buffer == NULL)
|
||||
{
|
||||
duk_push_null(ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just convert to a string
|
||||
duk_push_lstring(ctx, buffer, strnlen_s(buffer, bufferLen)); // [buffer][string]
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user