cred: add a free function wrapper

This commit is contained in:
Carlos Martín Nieto 2015-08-19 00:46:28 +02:00
parent 47ed7e5acd
commit 57af0b928e
2 changed files with 19 additions and 0 deletions

View File

@ -307,6 +307,17 @@ GIT_EXTERN(int) git_cred_ssh_key_memory_new(
const char *privatekey,
const char *passphrase);
/**
* Free a credential.
*
* This is only necessary if you own the object; that is, if you are a
* transport.
*
* @param cred the object to free
*/
GIT_EXTERN(void) git_cred_free(git_cred *cred);
/**
* Signature of a function which acquires a credential object.
*

View File

@ -378,3 +378,11 @@ int git_cred_username_new(git_cred **cred, const char *username)
*cred = (git_cred *) c;
return 0;
}
void git_cred_free(git_cred *cred)
{
if (!cred)
return;
cred->free(cred);
}