File: OpenSSL/crypto/crypto.c
Function: crypto_dump_certificate
Error: returning (PyObject*)NULL without setting an exception
297 static PyObject *
298 crypto_dump_certificate(PyObject *spam, PyObject *args)
299 {
300     int type, ret, buf_len;
301     char *temp;
302     PyObject *buffer;
303     BIO *bio;
304     crypto_X509Obj *cert;
305 
306     if (!PyArg_ParseTuple(args, "iO!:dump_certificate", &type,
when PyArg_ParseTuple() succeeds
taking False path
307 			  &crypto_X509_Type, &cert))
308         return NULL;
309 
310     bio = BIO_new(BIO_s_mem());
311     switch (type)
when following case 1
312     {
313         case X509_FILETYPE_PEM:
314             ret = PEM_write_bio_X509(bio, cert->x509);
315             break;
316 
317         case X509_FILETYPE_ASN1:
318             ret = i2d_X509_bio(bio, cert->x509);
319             break;
320 
321         case X509_FILETYPE_TEXT:
322             ret = X509_print_ex(bio, cert->x509, 0, 0);
323             break;
324 
325         default:
326             PyErr_SetString(PyExc_ValueError, "type argument must be FILETYPE_PEM, FILETYPE_ASN1, or FILETYPE_TEXT");
327             BIO_free(bio);
328             return NULL;
329     }
330 
331     if (ret == 0)
when considering value == (int)0 from OpenSSL/crypto/crypto.c:314
taking True path
332     {
333         BIO_free(bio);
334         exception_from_error_queue(crypto_Error);
335         return NULL;
336     }
337 
338     buf_len = BIO_get_mem_data(bio, &temp);
339     buffer = PyBytes_FromStringAndSize(temp, buf_len);
340     BIO_free(bio);
341 
342     return buffer;
343 }
returning (PyObject*)NULL without setting an exception
found 2 similar trace(s) to this