This repository was archived by the owner on Mar 8, 2018. It is now read-only.
File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -282,7 +282,7 @@ PyObject *py_yajldecoder_decode(PYARGS)
282
282
_YajlDecoder * decoder = (_YajlDecoder * )(self );
283
283
char * buffer = NULL ;
284
284
PyObject * pybuffer = NULL ;
285
- PyObject * alternate = NULL ;
285
+ PyObject * result = NULL ;
286
286
Py_ssize_t buflen = 0 ;
287
287
288
288
if (!PyArg_ParseTuple (args , "O" , & pybuffer ))
@@ -291,12 +291,13 @@ PyObject *py_yajldecoder_decode(PYARGS)
291
291
Py_INCREF (pybuffer );
292
292
293
293
if (PyUnicode_Check (pybuffer )) {
294
- if (!(alternate = PyUnicode_AsUTF8String (pybuffer ))) {
294
+ if (!(result = PyUnicode_AsUTF8String (pybuffer ))) {
295
295
Py_DECREF (pybuffer );
296
296
return NULL ;
297
297
}
298
298
Py_DECREF (pybuffer );
299
- pybuffer = alternate ;
299
+ pybuffer = result ;
300
+ result = NULL ;
300
301
}
301
302
302
303
if (PyString_Check (pybuffer )) {
@@ -317,7 +318,10 @@ PyObject *py_yajldecoder_decode(PYARGS)
317
318
PyUnicode_FromString ("Cannot parse an empty buffer" ));
318
319
return NULL ;
319
320
}
320
- return _internal_decode (decoder , buffer , (unsigned int )buflen );
321
+
322
+ result = _internal_decode (decoder , buffer , (unsigned int )buflen );
323
+ Py_DECREF (pybuffer );
324
+ return result ;
321
325
}
322
326
323
327
int yajldecoder_init (PYARGS )
You can’t perform that action at this time.
0 commit comments