mirror of
https://github.com/containers/crun.git
synced 2026-02-06 00:46:06 +01:00
python: reset pointer after asprintf failure
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
This commit is contained in:
@@ -55,6 +55,8 @@ set_error (libcrun_error_t *err)
|
||||
ret = asprintf (&msg, "%s: %s", (*err)->msg, strerror ((*err)->status));
|
||||
if (LIKELY (ret >= 0))
|
||||
PyErr_SetString (PyExc_RuntimeError, msg);
|
||||
else
|
||||
msg = NULL;
|
||||
}
|
||||
|
||||
libcrun_error_release (err);
|
||||
@@ -405,6 +407,8 @@ container_update (PyObject *self arg_unused, PyObject *args)
|
||||
ret = asprintf (&msg, "cannot parse process: %s", parser_err);
|
||||
if (LIKELY (ret >= 0))
|
||||
PyErr_SetString (PyExc_RuntimeError, msg);
|
||||
else
|
||||
msg = NULL;
|
||||
free (parser_err);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user