Thanks to visit codestin.com
Credit goes to github.com

Skip to content

params.language is leaking memory and crashes if assigned with None #68

@PiotrCzapla

Description

@PiotrCzapla

The lib was crashing on my Mac with python 3.11, after checking why tit seems that the lines are problematic:

https://github.com/abdeladim-s/pywhispercpp/blob/6fdccd7a1d6ef758020e7c116fad511794777e58/src/main.cpp#L483C6-L485C123

I noticed that the sizeof is being used for memory allocation, which returns the size of the pointer rather than the length of the string itself. To get the actual string size we should use strlen.

Also, I see that malloc is used, but there’s no mechanism in place to free the memory afterwards, which could lead to memory leaks.

I’ll send you a PR in a sec to address these issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions