summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2016-11-25 15:02:34 +0100
committerPatrick Steinhardt <ps@pks.im>2016-12-12 09:16:33 +0100
commit34b320535bde5505429f1349fc7d5cc423857a20 (patch)
treed4a619ea328bf79b66b324120141edef01521a47
parente781a0c52f2816ea5e9ba83f58b9808c0e42024f (diff)
downloadlibgit2-34b320535bde5505429f1349fc7d5cc423857a20.tar.gz
Fix potential use of uninitialized values
-rw-r--r--src/pack.c4
-rw-r--r--src/patch_generate.c2
-rw-r--r--src/transports/smart_protocol.c2
3 files changed, 5 insertions, 3 deletions
diff --git a/src/pack.c b/src/pack.c
index 2ee0c60e4..56de64d57 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -509,8 +509,10 @@ int git_packfile_resolve_header(
git_packfile_stream_free(&stream);
if (error < 0)
return error;
- } else
+ } else {
*size_p = size;
+ base_offset = 0;
+ }
while (type == GIT_OBJ_OFS_DELTA || type == GIT_OBJ_REF_DELTA) {
curpos = base_offset;
diff --git a/src/patch_generate.c b/src/patch_generate.c
index a13f2ff5d..0e5d1db31 100644
--- a/src/patch_generate.c
+++ b/src/patch_generate.c
@@ -284,7 +284,7 @@ static int create_binary(
size_t b_datalen)
{
git_buf deflate = GIT_BUF_INIT, delta = GIT_BUF_INIT;
- size_t delta_data_len;
+ size_t delta_data_len = 0;
int error;
/* The git_delta function accepts unsigned long only */
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index c41de4e23..53c0b089e 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -728,7 +728,7 @@ static int add_push_report_pkt(git_push *push, git_pkt *pkt)
static int add_push_report_sideband_pkt(git_push *push, git_pkt_data *data_pkt, git_buf *data_pkt_buf)
{
git_pkt *pkt;
- const char *line, *line_end;
+ const char *line, *line_end = NULL;
size_t line_len;
int error;
int reading_from_buf = data_pkt_buf->size > 0;