Skip to content

Instantly share code, notes, and snippets.

@jflatow
Created May 16, 2011 18:15
Show Gist options
  • Save jflatow/974989 to your computer and use it in GitHub Desktop.
Save jflatow/974989 to your computer and use it in GitHub Desktop.
gitlib2:git_index_free memory leak minimal example
#include <stdio.h>
#include <git2.h>
int
main(int argc, char **argv) {
git_repository *repo;
git_index *index;
int error = git_repository_open(&repo, ".git");
printf("%s\n", error ? git_strerror(error) : "opened repo");
error = git_repository_index(&index, repo);
printf("%s\n", error ? git_strerror(error) : "success");
git_repository_free(repo);
git_index_free(index);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment