Skip to content

Do not free EmbPattern we did not create in emb_pattern_{read,write}Auto#241

Open
norriscm wants to merge 1 commit intoEmbroidermodder:mainfrom
norriscm:bugfix/pattern-double-free
Open

Do not free EmbPattern we did not create in emb_pattern_{read,write}Auto#241
norriscm wants to merge 1 commit intoEmbroidermodder:mainfrom
norriscm:bugfix/pattern-double-free

Conversation

@norriscm
Copy link

emb_pattern_{read,write}Auto take an EmbPattern * that was created by the caller, which the caller is responsible for freeing. The error handler for unsupported format, however, was freeing the pattern, leading to a double-free when the caller tries to free the pattern. Remove the erroneous calls to emb_pattern_free.

I checked all functions that call emb_pattern_free to confirm that they only free patterns that they created; they are good.

emb_pattern_{read,write}Auto take an EmbPattern * that was created by the caller, which the caller is responsible for freeing. The error handler for unsupported format, however, was freeing the pattern, leading to a double-free when the caller tries to free the pattern. Remove the erroneous calls to emb_pattern_free.

I checked all functions that call emb_pattern_free to confirm that they only free patterns that they created; they are good.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant