1465 static PyObject *
1466 cntr_trace(Csite *site, double levels[], int nlevels, int points, long nchunk)
1467 {
1468 PyObject *c_list;
1469 double *xp0;
1470 double *yp0;
1471 long *nseg0;
1472 int iseg;
1473
1474 /* long nchunk = 30; was hardwired */
1475 long n;
1476 long nparts = 0;
1477 long ntotal = 0;
1478 long nparts2 = 0;
1479 long ntotal2 = 0;
1480
1481 site->zlevel[0] = levels[0];
when treating unknown double * from helpers/src/_nc_cntr.c:1466 as non-NULL
when treating unknown struct Csite * from helpers/src/_nc_cntr.c:1466 as non-NULL
1482 site->zlevel[1] = levels[0];
1483 if (nlevels == 2)
when considering range: -0x80000000 <= value <= 1
taking False path
1484 {
1485 site->zlevel[1] = levels[1];
1486 }
1487 site->n = site->count = 0;
1488 data_init (site, 0, nchunk);
1489
1490 /* make first pass to compute required sizes for second pass */
1491 for (;;)
1492 {
1493 n = curve_tracer (site, 0);
1494
1495 if (!n)
when considering range: -0x8000000000000000 <= value <= -1
taking False path
when considering value == (long int)0 from helpers/src/_nc_cntr.c:1493
taking True path
1496 break;
1497 if (n > 0)
taking False path
1498 {
1499 nparts++;
1500 ntotal += n;
1501 }
1502 else
1503 {
1504 ntotal -= n;
1505 }
1506 }
1507 xp0 = (double *) PyMem_Malloc(ntotal * sizeof(double));
when PyMem_Malloc() fails
1508 yp0 = (double *) PyMem_Malloc(ntotal * sizeof(double));
when PyMem_Malloc() succeeds
1509 nseg0 = (long *) PyMem_Malloc(nparts * sizeof(long));
when PyMem_Malloc() succeeds
1510 if (xp0 == NULL || yp0 == NULL || nseg0 == NULL) goto error;
taking True path
1511
1512 /* second pass */
1513 site->xcp = xp0;
1514 site->ycp = yp0;
1515 iseg = 0;
1516 for (;;iseg++)
1517 {
1518 n = curve_tracer (site, 1);
1519 if (ntotal2 + n > ntotal)
1520 {
1521 PyErr_SetString(PyExc_RuntimeError,
1522 "curve_tracer: ntotal2, pass 2 exceeds ntotal, pass 1");
1523 goto error;
1524 }
1525 if (n == 0)
1526 break;
1527 if (n > 0)
1528 {
1529 /* could add array bounds checking */
1530 nseg0[iseg] = n;
1531 site->xcp += n;
1532 site->ycp += n;
1533 ntotal2 += n;
1534 nparts2++;
1535 }
1536 else
1537 {
1538 PyErr_SetString(PyExc_RuntimeError,
1539 "Negative n from curve_tracer in pass 2");
1540 goto error;
1541 }
1542 }
1543
1544
1545 if (points)
1546 {
1547 c_list = build_cntr_list_p(nseg0, xp0, yp0, nparts, ntotal);
1548 }
1549 else
1550 {
1551 c_list = build_cntr_list_v2(nseg0, xp0, yp0, nparts, ntotal);
1552 }
1553 PyMem_Free(xp0); PyMem_Free(yp0); PyMem_Free(nseg0);
1554 site->xcp = NULL; site->ycp = NULL;
1555 return c_list;
1556
1557 error:
1558 PyMem_Free(xp0); PyMem_Free(yp0); PyMem_Free(nseg0);
calling PyMem_Free on NULL
calling PyMem_Free on PyMem_Malloc allocated at helpers/src/_nc_cntr.c:1508
calling PyMem_Free on PyMem_Malloc allocated at helpers/src/_nc_cntr.c:1509
1559 site->xcp = NULL; site->ycp = NULL;
1560 return NULL;
1561 }
returning (PyObject*)NULL without setting an exception
found 3 similar trace(s) to this