On Sun, Jun 16, 2019 at 6:40 PM Pavel Bar pbar@redhat.com wrote:
I think there are more places like that in "sanlock.c".
git grep thinks differently:
$ git grep -B1 'free(' python python/sanlock.c-exit_fail: python/sanlock.c: free(res); -- python/sanlock.c- Py_XDECREF(resource); python/sanlock.c: free(res); -- python/sanlock.c-finally: python/sanlock.c: free(rs); -- python/sanlock.c- Py_XDECREF(resource); python/sanlock.c: free(rs); -- python/sanlock.c- /* success */ python/sanlock.c: free(lss); -- python/sanlock.c-exit_fail: python/sanlock.c: if (lss) free(lss); -- python/sanlock.c- Py_XDECREF(lockspace); python/sanlock.c: free(hss); -- python/sanlock.c- Py_XDECREF(resource); python/sanlock.c: free(res); -- python/sanlock.c- Py_XDECREF(resource); python/sanlock.c: free(res); -- python/sanlock.c- Py_XDECREF(resource); python/sanlock.c: free(res); -- python/sanlock.c- Py_XDECREF(resource); python/sanlock.c: free(res); python/sanlock.c: free(hss);
On Fri, Jun 14, 2019 at 11:54 PM Nir Soffer nirsof@gmail.com wrote:
When calling free() we don't need to check if a point is NULL.
Signed-off-by: Nir Soffer nsoffer@redhat.com
python/sanlock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python/sanlock.c b/python/sanlock.c index ed9de0f..4c3e0a0 100644 --- a/python/sanlock.c +++ b/python/sanlock.c @@ -1025,11 +1025,11 @@ py_get_lockspaces(PyObject *self __unused, PyObject *args, PyObject *keywds) free(lss); return ls_list;
/* failure */exit_fail:
- if (lss) free(lss);
- free(lss); Py_XDECREF(ls_entry); Py_XDECREF(ls_list); return NULL;
}
-- 2.17.2
sanlock-devel@lists.fedorahosted.org