Skip to content

Commit 25a8f80

Browse files
rscharfegitster
authored andcommitted
clean: release strbuf after use in remove_dirs()
Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 861e655 commit 25a8f80

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

builtin/clean.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
167167
}
168168

169169
*dir_gone = 0;
170-
return 0;
170+
goto out;
171171
}
172172

173173
dir = opendir(path->buf);
@@ -181,7 +181,8 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
181181
warning_errno(_(msg_warn_remove_failed), quoted.buf);
182182
*dir_gone = 0;
183183
}
184-
return res;
184+
ret = res;
185+
goto out;
185186
}
186187

187188
strbuf_complete(path, '/');
@@ -249,6 +250,8 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
249250
for (i = 0; i < dels.nr; i++)
250251
printf(dry_run ? _(msg_would_remove) : _(msg_remove), dels.items[i].string);
251252
}
253+
out:
254+
strbuf_release(&quoted);
252255
string_list_clear(&dels, 0);
253256
return ret;
254257
}

0 commit comments

Comments
 (0)