Skip to content

Commit

Permalink
Fix Memory Corruption in update_DropRoleStmt (#1434) (#1613)
Browse files Browse the repository at this point in the history
Previously, sys.drop_all_logins() function call was throwing error when
it encounters login or user with considerably long name due to memory
corruption in update_DropRoleStmt().

To fix above issue, We removed explicit memory deallocation of first
element of stmt->roles list. It is not needed because list_delete_cell
already handles the memory deallocation.

Task: BABEL-4041

Signed-off-by: Harsh Lunagariya <[email protected]>
  • Loading branch information
HarshLunagariya authored Jul 24, 2023
1 parent 0c563a2 commit c9fbe60
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions contrib/babelfishpg_tsql/src/pltsql_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,6 @@ update_DropRoleStmt(Node *n, const char *role)
if (strcmp(tmp->rolename, "is_role") == 0)
stmt->roles = list_delete_cell(stmt->roles, list_head(stmt->roles));

pfree(tmp);

if (!stmt->roles)
return;

Expand Down

0 comments on commit c9fbe60

Please sign in to comment.