* Frees all memory allocated for the consolidated privileges list, * including strings and hash table entries. */
| 668 | * including strings and hash table entries. |
| 669 | */ |
| 670 | static void |
| 671 | DeepFreePrivileges(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 | |
| 704 | List * |
no test coverage detected