diff options
Diffstat (limited to 'python/rpmds-py.c')
-rw-r--r-- | python/rpmds-py.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/python/rpmds-py.c b/python/rpmds-py.c index 25cd3e38c..0c3a45928 100644 --- a/python/rpmds-py.c +++ b/python/rpmds-py.c @@ -468,11 +468,11 @@ fprintf(stderr, "%p -- ds %p\n", s, s->ds); */ static PyObject * rpmds_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds) { - rpmdsObject * s = (void *) PyObject_New(rpmdsObject, subtype); hdrObject * ho = NULL; PyObject * to = NULL; rpmTag tagN = RPMTAG_REQUIRENAME; rpmsenseFlags flags = 0; + rpmds ds = NULL; char * kwlist[] = {"header", "tag", "flags", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|Oi:rpmds_new", kwlist, @@ -483,9 +483,9 @@ static PyObject * rpmds_new(PyTypeObject * subtype, PyObject *args, PyObject *kw tagN = tagNumFromPyObject(to); if (tagN == RPMTAG_NOT_FOUND) return NULL; } - s->ds = rpmdsNew(hdrGetHeader(ho), tagN, 0); + ds = rpmdsNew(hdrGetHeader(ho), tagN, 0); - return (PyObject *)s; + return rpmds_Wrap(ds); } /** @@ -549,9 +549,8 @@ rpmds dsFromDs(rpmdsObject * s) PyObject * rpmds_Wrap(rpmds ds) { rpmdsObject * s = PyObject_New(rpmdsObject, &rpmds_Type); + if (s == NULL) return PyErr_NoMemory(); - if (s == NULL) - return NULL; s->ds = ds; s->active = 0; return (PyObject *) s; |