Skip to content

Commit

Permalink
fix: buffer free after decoding to string
Browse files Browse the repository at this point in the history
Signed-off-by: Ariel Gentile <[email protected]>
  • Loading branch information
genaris committed Aug 31, 2023
1 parent 720d05d commit 9cd430c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions wrappers/javascript/anoncreds-nodejs/src/NodeJSAnoncreds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -724,11 +724,13 @@ export class NodeJSAnoncreds implements Anoncreds {
this.handleError()

const returnValue = handleReturnPointer<{ data: Buffer; len: number }>(ret)
const output = new Uint8Array(byteBufferToBuffer(returnValue))
const jsonAsArray = new Uint8Array(byteBufferToBuffer(returnValue))

const output = new TextDecoder().decode(jsonAsArray)

this.nativeAnoncreds.anoncreds_buffer_free(returnValue.data)

return new TextDecoder().decode(output)
return output
}

public getTypeName(options: { objectHandle: ObjectHandle }) {
Expand Down

0 comments on commit 9cd430c

Please sign in to comment.