Skip to content

Commit 0664ee8

Browse files
committed
Repository.status(): Fix leak in error path
1 parent 464836c commit 0664ee8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/repository.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1596,14 +1596,14 @@ Repository_status(Repository *self)
15961596
size_t len, i;
15971597
git_status_list *list;
15981598

1599-
dict = PyDict_New();
1600-
if (dict == NULL)
1601-
return NULL;
1602-
16031599
err = git_status_list_new(&list, self->repo, NULL);
16041600
if (err < 0)
16051601
return Error_set(err);
16061602

1603+
dict = PyDict_New();
1604+
if (dict == NULL)
1605+
goto error;
1606+
16071607
len = git_status_list_entrycount(list);
16081608
for (i = 0; i < len; i++) {
16091609
const git_status_entry *entry;

0 commit comments

Comments
 (0)