Skip to content
This repository was archived by the owner on Mar 19, 2020. It is now read-only.

Commit dc662b3

Browse files
committed
python3: Fix crashes in snapshot()
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 <[email protected]> Acked-by: Serge E. Hallyn <[email protected]>
1 parent b95f410 commit dc662b3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lxc.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static lxc_attach_options_t *lxc_attach_parse_options(PyObject *kwds)
173173
PyObject *stdout_obj = NULL;
174174
PyObject *stderr_obj = NULL;
175175
PyObject *initial_cwd_obj = NULL;
176-
PyObject *dummy;
176+
PyObject *dummy = NULL;
177177
bool parse_result;
178178

179179
lxc_attach_options_t default_options = LXC_ATTACH_OPTIONS_DEFAULT;
@@ -733,7 +733,8 @@ Container_create(Container *self, PyObject *args, PyObject *kwds)
733733
char* template_name = NULL;
734734
int flags = 0;
735735
char** create_args = {NULL};
736-
PyObject *retval = NULL, *vargs = NULL;
736+
PyObject *retval = NULL;
737+
PyObject *vargs = NULL;
737738
int i = 0;
738739
static char *kwlist[] = {"template", "flags", "args", NULL};
739740

@@ -1225,7 +1226,7 @@ Container_snapshot(Container *self, PyObject *args, PyObject *kwds)
12251226
int retval = 0;
12261227
int ret = 0;
12271228
char newname[20];
1228-
PyObject *py_comment_path;
1229+
PyObject *py_comment_path = NULL;
12291230

12301231
if (! PyArg_ParseTupleAndKeywords(args, kwds, "|O&", kwlist,
12311232
PyUnicode_FSConverter, &py_comment_path))

0 commit comments

Comments
 (0)