Skip to content

Commit

Permalink
cleanup: add calls to free
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Sep 18, 2024
1 parent 89321ba commit 9e1a43e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/call-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ export class CallContext {
if (item === null) {
return 0n;
}
this.free(addr);

const key = item.string();
const result = this.getVariable(key);
Expand All @@ -323,6 +324,7 @@ export class CallContext {
this.#logger.error(`attempted to set variable using invalid key address (addr="${addr.toString(16)}H")`);
return;
}
this.free(addr);

const key = item.string();

Expand All @@ -349,6 +351,8 @@ export class CallContext {
this.setError(err)
return;
}

this.free(valueaddr);
},

http_request: (_requestOffset: bigint, _bodyOffset: bigint): bigint => {
Expand Down Expand Up @@ -380,6 +384,7 @@ export class CallContext {
}
const text = this.#decoder.decode(block.buffer);
this.#logger.warn(text);
this.free(addr);
},

log_info: (addr: bigint) => {
Expand All @@ -393,6 +398,7 @@ export class CallContext {
}
const text = this.#decoder.decode(block.buffer);
this.#logger.info(text);
this.free(addr);
},

log_debug: (addr: bigint) => {
Expand All @@ -406,6 +412,7 @@ export class CallContext {
}
const text = this.#decoder.decode(block.buffer);
this.#logger.debug(text);
this.free(addr);
},

log_error: (addr: bigint) => {
Expand All @@ -419,6 +426,7 @@ export class CallContext {
}
const text = this.#decoder.decode(block.buffer);
this.#logger.error(text);
this.free(addr);
},
};

Expand Down

0 comments on commit 9e1a43e

Please sign in to comment.