Skip to content

Commit

Permalink
fix memory management
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Nov 7, 2024
1 parent f5bcb72 commit 80a4e45
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ extern "C" {
free(repo->url);
free(repo->alias);
free(repo->userName);
free(repo);
}

void free_repository_list(struct RepositoryList* list) {
for (unsigned i = 0; i < list->size; ++i) {
free_repository(list->repos+i);
}
free(list->repos);
}

struct RepositoryList list_repositories() {
Expand Down
1 change: 1 addition & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ int main() {
struct Repository* repo = list.repos + i;
printf("repo %i: %s\n", i, repo->userName);
}
free_repository_list(&list);
return 0;
}

0 comments on commit 80a4e45

Please sign in to comment.