-
Notifications
You must be signed in to change notification settings - Fork 10
Tidy sanitizers' suppressions list and fix some mem leaks #438
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
base: TDE_REL_17_STABLE
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -562,6 +562,51 @@ check_provider_record(KeyringProviderRecord *provider_record) | |
|
||
#endif /* !FRONTEND */ | ||
|
||
void | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need to decide whether we like the "register key provider" stuff. If we do then each key provider type needs to be responsible for how to free their own specific version of GenericKeyring. If we don't, we need to remove it. Doing it both ways is just messy. I know this function wouldn't be the only place that ignores the register key provider functionality, but we need to make a decision whether we want to keep it or not before adding more code that ignores it imho. |
||
free_keyring(GenericKeyring *keyring) | ||
{ | ||
FileKeyring *file = (FileKeyring *) keyring; | ||
VaultV2Keyring *vault = (VaultV2Keyring *) keyring; | ||
KmipKeyring *kmip = (KmipKeyring *) keyring; | ||
|
||
switch (keyring->type) | ||
{ | ||
case FILE_KEY_PROVIDER: | ||
if (file->file_name) | ||
pfree(file->file_name); | ||
break; | ||
case VAULT_V2_KEY_PROVIDER: | ||
if (vault->vault_ca_path) | ||
pfree(vault->vault_ca_path); | ||
if (vault->vault_mount_path) | ||
pfree(vault->vault_mount_path); | ||
if (vault->vault_token) | ||
pfree(vault->vault_token); | ||
if (vault->vault_token_path) | ||
pfree(vault->vault_token_path); | ||
if (vault->vault_url) | ||
pfree(vault->vault_url); | ||
break; | ||
case KMIP_KEY_PROVIDER: | ||
if (kmip->kmip_ca_path) | ||
pfree(kmip->kmip_ca_path); | ||
if (kmip->kmip_cert_path) | ||
pfree(kmip->kmip_cert_path); | ||
if (kmip->kmip_host) | ||
pfree(kmip->kmip_host); | ||
if (kmip->kmip_key_path) | ||
pfree(kmip->kmip_key_path); | ||
if (kmip->kmip_port) | ||
pfree(kmip->kmip_port); | ||
break; | ||
default: | ||
Assert(false); | ||
break; | ||
} | ||
|
||
pfree(keyring); | ||
} | ||
|
||
void | ||
write_key_provider_info(KeyringProviderRecordInFile *record, bool write_xlog) | ||
{ | ||
|
@@ -682,6 +727,8 @@ simple_list_free(SimplePtrList *list) | |
pfree(cell); | ||
cell = next; | ||
} | ||
|
||
pfree(list); | ||
} | ||
#endif /* FRONTEND */ | ||
|
||
|
@@ -818,6 +865,8 @@ load_file_keyring_provider_options(char *keyring_options) | |
ereport(WARNING, | ||
errcode(ERRCODE_INVALID_PARAMETER_VALUE), | ||
errmsg("file path is missing in the keyring options")); | ||
|
||
free_keyring((GenericKeyring *) file_keyring); | ||
return NULL; | ||
} | ||
|
||
|
@@ -845,6 +894,8 @@ load_vaultV2_keyring_provider_options(char *keyring_options) | |
(vaultV2_keyring->vault_token_path != NULL && vaultV2_keyring->vault_token_path[0] != '\0') ? "" : " tokenPath", | ||
(vaultV2_keyring->vault_url != NULL && vaultV2_keyring->vault_url[0] != '\0') ? "" : " url", | ||
(vaultV2_keyring->vault_mount_path != NULL && vaultV2_keyring->vault_mount_path[0] != '\0') ? "" : " mountPath")); | ||
|
||
free_keyring((GenericKeyring *) vaultV2_keyring); | ||
return NULL; | ||
} | ||
|
||
|
@@ -878,6 +929,8 @@ load_kmip_keyring_provider_options(char *keyring_options) | |
(kmip_keyring->kmip_ca_path != NULL && kmip_keyring->kmip_ca_path[0] != '\0') ? "" : " caPath", | ||
(kmip_keyring->kmip_cert_path != NULL && kmip_keyring->kmip_cert_path[0] != '\0') ? "" : " certPath", | ||
(kmip_keyring->kmip_key_path != NULL && kmip_keyring->kmip_key_path[0] != '\0') ? "" : " keyPath")); | ||
|
||
free_keyring((GenericKeyring *) kmip_keyring); | ||
return NULL; | ||
} | ||
|
||
|
@@ -946,7 +999,10 @@ debug_print_kerying(GenericKeyring *keyring) | |
static inline void | ||
get_keyring_infofile_path(char *resPath, Oid dbOid) | ||
{ | ||
join_path_components(resPath, pg_tde_get_data_dir(), psprintf(PG_TDE_KEYRING_FILENAME, dbOid)); | ||
char *fname = psprintf(PG_TDE_KEYRING_FILENAME, dbOid); | ||
|
||
join_path_components(resPath, pg_tde_get_data_dir(), fname); | ||
pfree(fname); | ||
} | ||
|
||
static int | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.