Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remaining memory leaks #521

Merged
merged 2 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/formats/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ int sd_script_decode(sd_script *script, const char *input, int *invalid_pos) {
}
goto failed_parse;
}

str_free(&src);
sd_script_frame_free(&frame);
return SD_SUCCESS;

failed_parse:
Expand Down
10 changes: 2 additions & 8 deletions src/formats/script.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,13 @@ int sd_script_decode(sd_script *script, const char *str, int *invalid_pos);
* Encodes the animation script structure back to an animation string.
* Note that if the decoded string contained oddities like prefixed zeroes in
* front of numbers, those will be automatically fixed. Therefore the output
* string may not be exactly like the input string. Filler tags (u,c,p,o,z)
* will also be removed.
*
* Note that the target str buffer needs to be large enough for the encoding operation.
* It is possible to find the encoded string buffer size by using sd_script_encoded_lenghth() function.
*
* \sa sd_script_encoded_length
* string may not be exactly like the input string.
*
* \retval SD_INVALID_INPUT Script or str parameter was NULL
* \retval SD_SUCCESS Successful operation
*
* \param script Script structure to encode
* \param str Target string object. Must be initialized!
* \param dst Target string object. Must be initialized!
*/
int sd_script_encode(const sd_script *script, str *dst);

Expand Down
Loading