Browse Source

fixed memory leak

pull/76/head
Khoren Markosyan 2 years ago
parent
commit
6567037a44
  1. 14
      .vscode/launch.json
  2. 3
      .vscode/settings.json
  3. 6
      ios/Classes/src/native_zxing.cpp

14
.vscode/launch.json vendored

@ -15,6 +15,20 @@
"request": "launch", "request": "launch",
"type": "dart" "type": "dart"
}, },
{
"name": "example (profile mode)",
"cwd": "example",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
},
{
"name": "example (release mode)",
"cwd": "example",
"request": "launch",
"type": "dart",
"flutterMode": "release"
},
{ {
"name": "ZXScanner", "name": "ZXScanner",
"cwd": "zxscanner", "cwd": "zxscanner",

3
.vscode/settings.json vendored

@ -5,6 +5,7 @@
"__nullptr": "cpp", "__nullptr": "cpp",
"codecvt": "cpp", "codecvt": "cpp",
"cmath": "cpp", "cmath": "cpp",
"array": "cpp" "array": "cpp",
"new": "cpp"
} }
} }

6
ios/Classes/src/native_zxing.cpp

@ -49,6 +49,9 @@ extern "C"
resultToCodeResult(&code, result); resultToCodeResult(&code, result);
} }
delete[] data;
delete[] bytes;
int evalInMillis = static_cast<int>(get_now() - start); int evalInMillis = static_cast<int>(get_now() - start);
platform_log("Read Barcode in: %d ms\n", evalInMillis); platform_log("Read Barcode in: %d ms\n", evalInMillis);
return code; return code;
@ -84,6 +87,9 @@ extern "C"
} }
} }
delete[] data;
delete[] bytes;
int evalInMillis = static_cast<int>(get_now() - start); int evalInMillis = static_cast<int>(get_now() - start);
platform_log("Read Barcode in: %d ms\n", evalInMillis); platform_log("Read Barcode in: %d ms\n", evalInMillis);
return {i, codes}; return {i, codes};

Loading…
Cancel
Save