summaryrefslogtreecommitdiff
path: root/source3/python
diff options
context:
space:
mode:
Diffstat (limited to 'source3/python')
-rw-r--r--source3/python/py_tdbpack.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/source3/python/py_tdbpack.c b/source3/python/py_tdbpack.c
index 6181a4918e..28cd529245 100644
--- a/source3/python/py_tdbpack.c
+++ b/source3/python/py_tdbpack.c
@@ -656,21 +656,21 @@ pytdbunpack_buffer(char **pbuf, int *plen, PyObject *val_list)
Returns a reference to None, or NULL for failure.
*/
static PyObject *pytdbunpack_item(char ch,
- char **pbuf,
- int *plen,
- PyObject *val_list)
+ char **pbuf,
+ int *plen,
+ PyObject *val_list)
{
- PyObject *unpacked;
+ PyObject *result;
if (ch == 'w') { /* 16-bit int */
- unpacked = pytdbunpack_int16(pbuf, plen);
+ result = pytdbunpack_int16(pbuf, plen);
}
else if (ch == 'd' || ch == 'p') { /* 32-bit int */
/* pointers can just come through as integers */
- unpacked = pytdbunpack_uint32(pbuf, plen);
+ result = pytdbunpack_uint32(pbuf, plen);
}
else if (ch == 'f' || ch == 'P') { /* nul-term string */
- unpacked = pytdbunpack_string(pbuf, plen, pytdb_unix_encoding);
+ result = pytdbunpack_string(pbuf, plen, pytdb_unix_encoding);
}
else if (ch == 'B') { /* length, buffer */
return pytdbunpack_buffer(pbuf, plen, val_list);
@@ -684,15 +684,10 @@ static PyObject *pytdbunpack_item(char ch,
}
/* otherwise OK */
- if (!unpacked)
+ if (!result)
+ return NULL;
+ if (PyList_Append(val_list, result) == -1)
return NULL;
-
- if (PyList_Append(val_list, unpacked) == -1)
- val_list = NULL;
-
- /* PyList_Append takes a new reference to the inserted object.
- Therefore, we no longer need the original reference. */
- Py_DECREF(unpacked);
return val_list;
}