diff options
| author | Carlos Martín Nieto <carlos@cmartin.tk> | 2011-06-08 23:38:22 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <carlos@cmartin.tk> | 2011-06-26 18:18:13 +0200 |
| commit | be9fe679fc86a8f233b0a6fc6078894edcb8661e (patch) | |
| tree | 4eb63e0fffb66400830b050cb5c50fd3139b8a69 /src/pkt.c | |
| parent | ecb6ca0e1f908c1480a602e8cca16bd8916b8a99 (diff) | |
| download | libgit2-be9fe679fc86a8f233b0a6fc6078894edcb8661e.tar.gz | |
Implement and use git_pkt_free
A git_pkt object can be one of several structs. Add this function for
convenience and clarity.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Diffstat (limited to 'src/pkt.c')
| -rw-r--r-- | src/pkt.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -173,6 +173,17 @@ int git_pkt_parse_line(git_pkt **head, const char *line, const char **out) return error; } +void git_pkt_free(git_pkt *pkt) +{ + if(pkt->type == GIT_PKT_REF) { + git_pkt_ref *p = (git_pkt_ref *) pkt; + free(p->capabilities); + free(p->head.name); + } + + free(pkt); +} + /* * Create a git procol request. * |
