diff options
author | Patrick Steinhardt <ps@pks.im> | 2016-02-09 09:58:56 +0100 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2016-02-09 09:58:56 +0100 |
commit | a53d2e3985505de0e1dcc580cd2c624fcf0fce93 (patch) | |
tree | e4b1a7a45e39c1d878b9f001df879072b21d5407 | |
parent | e0bbe78134007747dcfd0164a2604a68d31e95c8 (diff) | |
download | libgit2-a53d2e3985505de0e1dcc580cd2c624fcf0fce93.tar.gz |
pack: do not free passed in poiter on error
The function `git_packfile_stream_open` tries to free the passed
in stream when an error occurs. The only call site is
`git_indexer_append`, though, which passes in the address of a
stream struct which has not been allocated on the heap.
Fix the issue by simply removing the call to free. In case of an
error we did not allocate any memory yet and otherwise it should
be the caller's responsibility to manage it's object's lifetime.
-rw-r--r-- | src/pack.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/pack.c b/src/pack.c index f6cb3a548..081e37084 100644 --- a/src/pack.c +++ b/src/pack.c @@ -790,7 +790,6 @@ int git_packfile_stream_open(git_packfile_stream *obj, struct git_pack_file *p, obj->zstream.next_out = Z_NULL; st = inflateInit(&obj->zstream); if (st != Z_OK) { - git__free(obj); giterr_set(GITERR_ZLIB, "failed to init packfile stream"); return -1; } |