Commit 2513f20abd32eca0e2f74e92abd73629b4360258

Stefan Sperling 2020-10-20T21:09:01

plug memory leaks in error paths; found by naddy

diff --git a/lib/worktree.c b/lib/worktree.c
index a46191b..330247e 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -2052,7 +2052,7 @@ remove_ondisk_file(const char *root_path, const char *path)
 			char *parent;
 			err = got_path_dirname(&parent, ondisk_path);
 			if (err)
-				return err;
+				break;
 			free(ondisk_path);
 			ondisk_path = parent;
 			if (rmdir(ondisk_path) == -1) {
@@ -3919,7 +3919,7 @@ schedule_for_deletion(void *arg, unsigned char status,
 			char *parent;
 			err = got_path_dirname(&parent, ondisk_path);
 			if (err)
-				return err;
+				goto done;
 			free(ondisk_path);
 			ondisk_path = parent;
 			if (rmdir(ondisk_path) == -1) {