From dc662b361dc3650f329063a7bc760a77262f95ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Mon, 9 Jun 2014 12:02:02 -0400 Subject: [PATCH] python3: Fix crashes in snapshot() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes sure all PyObject structs are always initialized to NULL, this will fix issues such as (issue #239). Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn --- lxc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lxc.c b/lxc.c index 43b019a..1cc43c9 100644 --- a/lxc.c +++ b/lxc.c @@ -173,7 +173,7 @@ static lxc_attach_options_t *lxc_attach_parse_options(PyObject *kwds) PyObject *stdout_obj = NULL; PyObject *stderr_obj = NULL; PyObject *initial_cwd_obj = NULL; - PyObject *dummy; + PyObject *dummy = NULL; bool parse_result; lxc_attach_options_t default_options = LXC_ATTACH_OPTIONS_DEFAULT; @@ -733,7 +733,8 @@ Container_create(Container *self, PyObject *args, PyObject *kwds) char* template_name = NULL; int flags = 0; char** create_args = {NULL}; - PyObject *retval = NULL, *vargs = NULL; + PyObject *retval = NULL; + PyObject *vargs = NULL; int i = 0; static char *kwlist[] = {"template", "flags", "args", NULL}; @@ -1225,7 +1226,7 @@ Container_snapshot(Container *self, PyObject *args, PyObject *kwds) int retval = 0; int ret = 0; char newname[20]; - PyObject *py_comment_path; + PyObject *py_comment_path = NULL; if (! PyArg_ParseTupleAndKeywords(args, kwds, "|O&", kwlist, PyUnicode_FSConverter, &py_comment_path))