Thread (16 messages) flat view 16 messages, 3 authors, 2016-06-15
STALE3740d

[PATCH 2/7] record_author_info: fix memory leak on malformed commit

From: Jeff King <hidden>
Date: 2016-06-15 23:01:41
Subsystem: the rest · Maintainer: Linus Torvalds

If we hit the end-of-header without finding an "author"
line, we just return from the function. We should jump to
the fail_exit path to clean up the buffer that we may have
allocated.

Signed-off-by: Jeff King <redacted>
---
 commit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commit.c b/commit.c
index d04b525..0c40cfa 100644
--- a/commit.c
+++ b/commit.c
@@ -617,7 +617,7 @@ static void record_author_date(struct author_date_slab *author_date,
 		ident_line = skip_prefix(buf, "author ");
 		if (!ident_line) {
 			if (!line_end[0] || line_end[1] == '\n')
-				return; /* end of header */
+				goto fail_exit; /* end of header */
 			continue;
 		}
 		if (split_ident_line(&ident,
-- 
2.0.0.566.gfe3e6b2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help