Skip to content

Commit

Permalink
Avoid SherpaOnnxSpeakerEmbeddingManagerFreeBestMatches freeing null. (#…
Browse files Browse the repository at this point in the history
…1296)

Fixes #1295
  • Loading branch information
csukuangfj authored Aug 28, 2024
1 parent 22c6f81 commit ca30d83
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sherpa-onnx/c-api/c-api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,10 @@ SherpaOnnxSpeakerEmbeddingManagerGetBestMatches(

void SherpaOnnxSpeakerEmbeddingManagerFreeBestMatches(
const SherpaOnnxSpeakerEmbeddingManagerBestMatchesResult *r) {
if (r == nullptr) {
return;
}

for (int32_t i = 0; i < r->count; ++i) {
delete[] r->matches[i].name;
}
Expand Down

0 comments on commit ca30d83

Please sign in to comment.