mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
gpg-interface: fix misdesigned signing key interfaces
The interfaces to retrieve signing keys and their IDs are misdesigned as they return string constants even though they indeed allocate memory, which leads to memory leaks. Refactor the code to instead always return allocated strings and let the callers free them accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
49d47eb541
commit
b8849e236f
@@ -80,13 +80,13 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature,
|
||||
const char *gpg_trust_level_to_str(enum signature_trust_level level);
|
||||
|
||||
void set_signing_key(const char *);
|
||||
const char *get_signing_key(void);
|
||||
char *get_signing_key(void);
|
||||
|
||||
/*
|
||||
* Returns a textual unique representation of the signing key in use
|
||||
* Either a GPG KeyID or a SSH Key Fingerprint
|
||||
*/
|
||||
const char *get_signing_key_id(void);
|
||||
char *get_signing_key_id(void);
|
||||
int check_signature(struct signature_check *sigc,
|
||||
const char *signature, size_t slen);
|
||||
void print_signature_buffer(const struct signature_check *sigc,
|
||||
|
||||
Reference in New Issue
Block a user