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 memory errors in modify_permission #1613

Merged
merged 2 commits into from
Jul 6, 2021
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Deprecated
### Removed
### Fixed
- Fix memory errors in modify_permission [#1613](https://github.com/greenbone/gvmd/pull/1613)

[Unreleased]: https://github.com/greenbone/gvmd/compare/v20.8.2...gvmd-20.08

Expand Down
3 changes: 2 additions & 1 deletion src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -43631,6 +43631,7 @@ modify_permission (const char *permission_id, const char *name_arg,
free (new_resource_id);
free (existing_subject_type);
free (new_subject_id);
g_free (subject_where_old);
sql_rollback ();
return ret;
}
Expand Down Expand Up @@ -43683,7 +43684,6 @@ modify_permission (const char *permission_id, const char *name_arg,
|| (resource_id == NULL));

quoted_name = sql_quote (name);
g_free (name);

sql ("UPDATE permissions SET"
" name = '%s',"
Expand Down Expand Up @@ -43767,6 +43767,7 @@ modify_permission (const char *permission_id, const char *name_arg,
free (new_resource_id);
free (existing_subject_type);
free (new_subject_id);
g_free (name);
free (old_name);
free (old_resource_type);
g_free (subject_where);
Expand Down