8000 Improve malloc/free call in summary_getproperty() · python/cpython@5291f2c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5291f2c

Browse files
committed
Improve malloc/free call in summary_getproperty()
This makes the malloc/free calls more trackable even when more types are added to MsiSummaryInfoGetProperty.
1 parent 6e4a70f commit 5291f2c

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

PC/_msi.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -560,19 +560,25 @@ summary_getproperty(msiobj* si, PyObject *args)
560560
}
561561

562562
switch(type) {
563-
case VT_I2: case VT_I4:
564-
return PyLong_FromLong(ival);
563+
case VT_I2:
564+
case VT_I4:
565+
result = PyLong_FromLong(ival);
566+
break;
565567
case VT_FILETIME:
566568
PyErr_SetString(PyExc_NotImplementedError, "FILETIME result");
567-
return NULL;
569+
result = NULL;
570+
break;
568571
case VT_LPSTR:
569572
result = PyBytes_FromStringAndSize(sval, ssize);
570-
if (sval != sbuf)
571-
free(sval);
572-
return result;
573+
break;
574+
default:
575+
PyErr_Format(PyExc_NotImplementedError, "result of type %d", type);
576+
result = NULL;
577+
break;
573578
}
574-
PyErr_Format(PyExc_NotImplementedError, "result of type %d", type);
575-
return NULL;
579+
if (sval != sbuf)
580+
free(sval);
581+
return result;
576582
}
577583

578584
static PyObject*

0 commit comments

Comments
 (0)
0