273 PyObject* encode_string(
274 PyObject* self,
275 PyObject* args,
276 PyObject* kwds
277 )
278 {
279 PyObject *Py_input_string;
280 PyObject *Py_output_string;
281 PyObject *retval;
282
283 Byte *input_buffer = NULL;
284 Byte *output_buffer = NULL;
285 int crc_value = -1;
286 int input_len = 0;
287 int output_len = 0;
288 int col = 0;
289 Crc32 crc;
290
291 static char *kwlist[] = { "string", "crc32", "column", NULL };
292 if(!PyArg_ParseTupleAndKeywords(args,
293 kwds,
when PyArg_ParseTupleAndKeywords() succeeds
taking False path
294 "O!|ii",
295 kwlist,
296 &PyString_Type,
297 &Py_input_string,
298 &crc_value,
299 &col
300 ))
301 return NULL;
302 crc_init(&crc, crc_value);
303 input_len = PyString_Size(Py_input_string);
304 input_buffer = PyString_AsString(Py_input_string);
when PyString_Size() succeeds
305 output_buffer = (char *) malloc(( 2 * input_len / LINESIZE + 1 ) * ( LINESIZE + 2 ));
when PyString_AsString() succeeds
306 output_len = encode_buffer(input_buffer, output_buffer, input_len, &crc, &col);
307 Py_output_string = PyString_FromStringAndSize(output_buffer, output_len);
308 retval = Py_BuildValue("(S,i,i)", Py_output_string, crc.crc, col);
when PyString_FromStringAndSize() fails
309
when Py_BuildValue() fails
310 free(output_buffer);
311 Py_DECREF(Py_output_string);
312
dereferencing NULL (Py_output_string->ob_refcnt) at src/_yenc.c:312
found 3 similar trace(s) to this
313 return retval;
314 }
315