commit 5a58a42470599ad46a3acd3fce47a6a1b7026a8b from: Stefan Sperling date: Tue Jun 23 16:10:01 2020 UTC plug a memory leak in delete_blob() commit - c34ec41754978e41240e8aedd4e5d3a9e6362635 commit + 5a58a42470599ad46a3acd3fce47a6a1b7026a8b blob - 1ad69b7dff719dd615ae921d1fc94b3ec3fabf39 blob + 3ffa1b33d2cc302973234fea30f6c19617636f3a --- lib/worktree.c +++ lib/worktree.c @@ -1450,33 +1450,32 @@ delete_blob(struct got_worktree *worktree, struct got_ err = get_file_status(&status, &sb, ie, ondisk_path, -1, NULL, repo); if (err) - return err; + goto done; if (status == GOT_STATUS_MODIFY || status == GOT_STATUS_CONFLICT || status == GOT_STATUS_ADD) { err = (*progress_cb)(progress_arg, GOT_STATUS_MERGE, ie->path); if (err) - return err; + goto done; /* * Preserve the working file and change the deleted blob's * entry into a schedule-add entry. */ err = got_fileindex_entry_update(ie, ondisk_path, NULL, NULL, 0); - if (err) - return err; } else { err = (*progress_cb)(progress_arg, GOT_STATUS_DELETE, ie->path); if (err) - return err; + goto done; if (status == GOT_STATUS_NO_CHANGE) { err = remove_ondisk_file(worktree->root_path, ie->path); if (err) - return err; + goto done; } got_fileindex_entry_remove(fileindex, ie); } - +done: + free(ondisk_path); return err; }