Skip to content

Commit

Permalink
Address final reviews
Browse files Browse the repository at this point in the history
Signed-off-by: P Aswini Kumar <[email protected]>
  • Loading branch information
P Aswini Kumar committed Sep 30, 2024
1 parent c356c89 commit 42c3ad8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions contrib/babelfishpg_tsql/src/multidb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,8 @@ get_physical_user_name(char *db_name, char *user_name, bool suppress_db_error, b
errmsg("User or role \"%s\" does not exist", new_user_name)));
}

pfree(new_user_name);

return result;
}

Expand Down
4 changes: 2 additions & 2 deletions contrib/babelfishpg_tsql/src/procedures.c
Original file line number Diff line number Diff line change
Expand Up @@ -2137,6 +2137,7 @@ sp_addrole(PG_FUNCTION_ARGS)
/* Map the logical role name to its physical name in the database. */
physical_role_name = get_physical_user_name(get_cur_db_name(), lowercase_rolname, false, true);
role_oid = get_role_oid(physical_role_name, true);
pfree(physical_role_name);

/* Check if the user, group or role already exists */
if (role_oid)
Expand Down Expand Up @@ -2193,7 +2194,6 @@ sp_addrole(PG_FUNCTION_ARGS)
set_config_option("babelfishpg_tsql.sql_dialect", saved_dialect,
GUC_CONTEXT_CONFIG,
PGC_S_SESSION, GUC_ACTION_SAVE, true, 0, false);
pfree(physical_role_name);
PG_RETURN_VOID();
}

Expand Down Expand Up @@ -2281,6 +2281,7 @@ sp_droprole(PG_FUNCTION_ARGS)
/* Map the logical role name to its physical name in the database. */
physical_role_name = get_physical_user_name(get_cur_db_name(), lowercase_rolname, false, true);
role_oid = get_role_oid(physical_role_name, true);
pfree(physical_role_name);

/* Check if the role does not exists */
if (role_oid == InvalidOid || !is_role(role_oid))
Expand Down Expand Up @@ -2332,7 +2333,6 @@ sp_droprole(PG_FUNCTION_ARGS)
set_config_option("babelfishpg_tsql.sql_dialect", saved_dialect,
GUC_CONTEXT_CONFIG,
PGC_S_SESSION, GUC_ACTION_SAVE, true, 0, false);
pfree(physical_role_name);
PG_RETURN_VOID();
}

Expand Down
2 changes: 1 addition & 1 deletion contrib/babelfishpg_tsql/src/rolecmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ user_id(PG_FUNCTION_ARGS)
}

auth_tuple = SearchSysCache1(AUTHNAME, CStringGetDatum(user_name));
pfree(user_name);
pfree(user_name);

if (!HeapTupleIsValid(auth_tuple))
PG_RETURN_NULL();
Expand Down

0 comments on commit 42c3ad8

Please sign in to comment.