Commit Diff


commit - 333ac74ecb8eb10c94850efc8c0e03273224c044
commit + a0de39f3978b1d152679279d6e2f82d573e81209
blob - 48602a49dc5401bfc8b556e00e54e00dc7ab15e0
blob + 7042801408a68d4e338c86b8fbc97d1afbacf471
--- got/got.c
+++ got/got.c
@@ -1083,7 +1083,7 @@ static const struct got_error *
 get_worktree_paths_from_argv(struct got_pathlist_head *paths, int argc,
     char *argv[], struct got_worktree *worktree)
 {
-	const struct got_error *err;
+	const struct got_error *err = NULL;
 	char *path;
 	int i;
 
@@ -4647,6 +4647,8 @@ histedit_check_script(struct got_histedit_list *histed
 	if (TAILQ_EMPTY(histedit_cmds))
 		return got_error_msg(GOT_ERR_EMPTY_HISTEDIT,
 		    "histedit script contains no commands");
+	if (SIMPLEQ_EMPTY(commits))
+		return got_error(GOT_ERR_EMPTY_HISTEDIT);
 
 	SIMPLEQ_FOREACH(qid, commits, entry) {
 		TAILQ_FOREACH(hle, histedit_cmds, entry) {
blob - eda1af09420ccb027636f66eca0fbf48834c4c5a
blob + e00d1afadd8e8acb4b5fc54c640fe23ccfe9d3bd
--- lib/blame.c
+++ lib/blame.c
@@ -413,8 +413,10 @@ done:
 static const struct got_error *
 blame_line(struct got_object_id **id, struct got_blame *blame, int lineno)
 {
-	if (lineno < 1 || lineno > blame->nlines)
+	if (lineno < 1 || lineno > blame->nlines) {
+		*id = NULL;
 		return got_error(GOT_ERR_RANGE);
+	}
 	*id = &blame->lines[lineno - 1].id;
 	return NULL;
 }
@@ -452,7 +454,7 @@ got_blame(const char *path, struct got_object_id *star
 	}
 
 	for (lineno = 1; lineno <= blame->nlines; lineno++) {
-		struct got_object_id *id;
+		struct got_object_id *id = NULL;
 		char *line, *id_str;
 
 		line = parse_next_line(blame->f, NULL);
blob - 0c1a60f2dfc20f83db4ea8e080052c0f16e340b3
blob + 6d876216ae17f82d4f9dee9e675e1577abd93a08
--- lib/object_cache.c
+++ lib/object_cache.c
@@ -157,6 +157,8 @@ got_object_cache_add(struct got_object_cache *cache, s
 	case GOT_OBJECT_CACHE_TYPE_TAG:
 		size = get_size_tag((struct got_tag_object *)item);
 		break;
+	default:
+		return got_error(GOT_ERR_OBJ_TYPE);
 	}
 
 	if (size > GOT_OBJECT_CACHE_MAX_ELEM_SIZE) {
blob - bbf328905eee14f84f5f38bd19931fccd02680ab
blob + a7eb8cd510563e49f6c0f23b5d12cdea3bc64c32
--- lib/object_parse.c
+++ lib/object_parse.c
@@ -607,6 +607,8 @@ parse_tree_entry(struct got_tree_entry **te, size_t *e
 {
 	char *p, *space;
 	const struct got_error *err = NULL;
+
+	*elen = 0;
 
 	*te = got_alloc_tree_entry_partial();
 	if (*te == NULL)
blob - d9d0f1136dd172399769d72beae81c13efd026e3
blob + 06a62113ffe0a63fdb765cfda02403a3a6264d2e
--- lib/pack.c
+++ lib/pack.c
@@ -628,6 +628,7 @@ parse_negative_offset(int64_t *offset, size_t *len, st
 	uint8_t offN;
 	int i = 0;
 
+	*offset = 0;
 	*len = 0;
 
 	do {
blob - 58f47bcb9d3d140efc6e5e0e4ddcfc432387e204
blob + d648267d6824b041a3d797dc1d2f990cabb398f4
--- lib/worktree.c
+++ lib/worktree.c
@@ -2363,7 +2363,7 @@ read_ignores(struct got_pathlist_head *ignores, const 
 	const struct got_error *err = NULL;
 	struct got_pathlist_entry *pe = NULL;
 	struct got_pathlist_head *ignorelist;
-	char *line = NULL, *pattern, *dirpath;
+	char *line = NULL, *pattern, *dirpath = NULL;
 	size_t linesize = 0;
 	ssize_t linelen;
 
blob - 210e39c80bba547ddbdb3c2104e35e07edec4ee8
blob + f6655bad906fba77894eae334a60fee416a4d689
--- tog/tog.c
+++ tog/tog.c
@@ -3979,6 +3979,8 @@ blame_tree_entry(struct tog_view **new_view, int begin
 	const struct got_error *err = NULL;
 	char *path;
 	struct tog_view *blame_view;
+
+	*new_view = NULL;
 
 	err = tree_entry_path(&path, parents, te);
 	if (err)
@@ -4006,6 +4008,8 @@ log_tree_entry(struct tog_view **new_view, int begin_x
 	struct tog_view *log_view;
 	const struct got_error *err = NULL;
 	char *path;
+
+	*new_view = NULL;
 
 	log_view = view_open(0, 0, 0, begin_x, TOG_VIEW_LOG);
 	if (log_view == NULL)
@@ -4113,7 +4117,7 @@ static const struct got_error *
 search_next_tree_view(struct tog_view *view)
 {
 	struct tog_tree_view_state *s = &view->state.tree;
-	struct got_tree_entry *entry, *te;
+	struct got_tree_entry *entry = NULL, *te;
 
 	if (!view->searching) {
 		view->search_next_done = 1;