-
-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start review for memory issues, with valgrind
Update valgrind suppression file for Python 3.7 Fix a memory leak in option(..) TODO: Review all calls to py_str_to_c_str, the returned value must be freed after use.
- Loading branch information
Showing
8 changed files
with
228 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
.PHONY: build | ||
|
||
build: | ||
python setup.py build_ext --inplace | ||
python setup.py build_ext --inplace -g | ||
|
||
html: | ||
cd docs && find . -name "*rst" | entr make html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -264,11 +264,15 @@ option(PyObject *self, PyObject *args) | |
case GIT_OPT_SET_SSL_CERT_LOCATIONS: | ||
{ | ||
PyObject *py_file, *py_dir; | ||
const char *file_path, *dir_path; | ||
char *file_path, *dir_path; | ||
int err; | ||
|
||
py_file = PyTuple_GetItem(args, 1); | ||
if (!py_file) | ||
return NULL; | ||
py_dir = PyTuple_GetItem(args, 2); | ||
if (!py_dir) | ||
return NULL; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
marco-c
|
||
|
||
/* py_file and py_dir are only valid if they are strings */ | ||
if (PyUnicode_Check(py_file) || PyBytes_Check(py_file)) { | ||
|
@@ -284,6 +288,8 @@ option(PyObject *self, PyObject *args) | |
} | ||
|
||
err = git_libgit2_opts(GIT_OPT_SET_SSL_CERT_LOCATIONS, file_path, dir_path); | ||
free(file_path); | ||
free(dir_path); | ||
|
||
if (err < 0) | ||
return Error_set(err); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Nit: you should probably free py_file here