From: Omar Polo Subject: fix use of uninitialized variable in update_blob To: gameoftrees@openbsd.org Date: Tue, 13 Feb 2024 20:18:57 +0100 both update_timestamps may be used un-initalized. Where here, do what I should have done in ef6234452a and remove the nested update_timestamps. spotted by smatch. ok? diff -s /home/op/w/got commit - 06bd8ee415aa89adaeb49825ad96dfe83554b77e path + /home/op/w/got (staged changes) blob - 866c19c894b29dffe0ffd1be3cbc2f6999ed8db4 blob + fc674d163162822cb326fcd1144a79b40778c452 --- lib/worktree.c +++ lib/worktree.c @@ -1920,7 +1920,7 @@ update_blob(struct got_worktree *worktree, unsigned char status = GOT_STATUS_NO_CHANGE; struct stat sb; int fd1 = -1, fd2 = -1; - int update_timestamps; + int update_timestamps = 0; if (asprintf(&ondisk_path, "%s/%s", worktree->root_path, path) == -1) return got_error_from_errno("asprintf"); @@ -2044,7 +2044,6 @@ update_blob(struct got_worktree *worktree, goto done; if (status == GOT_STATUS_MODIFY || status == GOT_STATUS_ADD) { - int update_timestamps; struct got_blob_object *blob2 = NULL; char *label_orig = NULL; if (got_fileindex_entry_has_blob(ie)) {