Skip to content

Commit c3ff246

Browse files
authored
Merge pull request emscripten-forge#27 from AnastasiaSliusar/fix-bugs-release-memory
Fix realese memory, clean code
2 parents 215c3db + e41185e commit c3ff246

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const fetchByteArray = async (url: string): Promise<Uint8Array> => {
1111
return new Uint8Array(arrayBuffer);
1212
};
1313

14-
const init = async (): Promise<IWasmModule | null> => {
14+
const init = async (): Promise<IWasmModule | null> => {
1515
try {
1616
const wasmModule = await initializeWasm();
1717
return wasmModule as IWasmModule;
@@ -66,8 +66,6 @@ export const extractData = async (data: Uint8Array): Promise<IFileData[]> => {
6666
*/
6767
const statusPtr = wasmModule.getValue(resultPtr + 8, 'i32');
6868
const errorMessagePtr = wasmModule.getValue(resultPtr + 12, 'i32');
69-
console.log('status', statusPtr);
70-
console.log('errorMessagePtr', errorMessagePtr);
7169
if (statusPtr !== 1) {
7270
const errorMessage = wasmModule.UTF8ToString(errorMessagePtr);
7371
console.error(
@@ -121,7 +119,6 @@ export const extractData = async (data: Uint8Array): Promise<IFileData[]> => {
121119

122120
wasmModule._free(inputPtr);
123121
wasmModule._free(fileCountPtr);
124-
wasmModule._free(statusPtr);
125122
wasmModule._free(errorMessagePtr);
126123
wasmModule._free(resultPtr);
127124

@@ -135,14 +132,14 @@ export const extractData = async (data: Uint8Array): Promise<IFileData[]> => {
135132
export const extract = async (url: string): Promise<IFileData[]> => {
136133
try {
137134
const data = await fetchByteArray(url);
138-
console.log('Data downloaded:', data);
139135
return await extractData(data);
140136
} catch (error) {
141137
console.error('Error during extracting:', error);
142138
return [];
143139
}
144140
};
145141

142+
146143
export * from './types';
147144

148145
export default {

0 commit comments

Comments
 (0)