Skip to content

Commit

Permalink
Update WalletManager_findWallets
Browse files Browse the repository at this point in the history
Do not free if the string returned is empty (it
crashes the library)
  • Loading branch information
MrCyjaneK committed Sep 3, 2024
1 parent 811ade0 commit 448dd55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion impls/monero.dart/lib/monero.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3595,7 +3595,9 @@ String WalletManager_findWallets(WalletManager wm_ptr, {required String path}) {
.cast<Utf8>();
final str = strPtr.toDartString();
calloc.free(path_);
MONERO_free(strPtr.cast());
if (str.isNotEmpty) {
MONERO_free(strPtr.cast());
}
debugEnd?.call('MONERO_WalletManager_findWallets');
return str;
} catch (e) {
Expand Down
4 changes: 3 additions & 1 deletion impls/monero.dart/lib/wownero.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3230,7 +3230,9 @@ String WalletManager_findWallets(WalletManager wm_ptr, {required String path}) {
.cast<Utf8>();
final str = strPtr.toDartString();
calloc.free(path_);
WOWNERO_free(strPtr.cast());
if (str.isNotEmpty) {
WOWNERO_free(strPtr.cast());
}
debugEnd?.call('WOWNERO_WalletManager_findWallets');
return str;
} catch (e) {
Expand Down

0 comments on commit 448dd55

Please sign in to comment.