MCPcopy Create free account
hub / github.com/documentdb/documentdb / DeepFreePrivileges

Function DeepFreePrivileges

pg_documentdb/src/utils/role_utils.c:670–701  ·  view source on GitHub ↗

* Frees all memory allocated for the consolidated privileges list, * including strings and hash table entries. */

Source from the content-addressed store, hash-verified

668 * including strings and hash table entries.
669 */
670static void
671DeepFreePrivileges(List *consolidatedPrivileges)
672{
673 if (consolidatedPrivileges == NIL)
674 {
675 return;
676 }
677
678 ListCell *privilege;
679 foreach(privilege, consolidatedPrivileges)
680 {
681 ConsolidatedPrivilege *currentPrivilege =
682 (ConsolidatedPrivilege *) lfirst(privilege);
683
684 if (currentPrivilege->db)
685 {
686 pfree((char *) currentPrivilege->db);
687 }
688
689 if (currentPrivilege->collection)
690 {
691 pfree((char *) currentPrivilege->collection);
692 }
693
694 if (currentPrivilege->actions)
695 {
696 hash_destroy(currentPrivilege->actions);
697 }
698 }
699
700 list_free_deep(consolidatedPrivileges);
701}
702
703
704List *

Callers 2

WritePrivilegesFunction · 0.85

Calls 1

foreachFunction · 0.50

Tested by

no test coverage detected