aboutsummaryrefslogtreecommitdiff
path: root/PC
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2018-09-07 16:02:56 -0600
committerBerker Peksag <berker.peksag@gmail.com>2018-09-08 01:02:56 +0300
commit4e519377b1b84c9414a360961276993d24198825 (patch)
tree34a8467111c8e6655e05d4d635f764a0fbb4ac03 /PC
parentbpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098) (diff)
downloadcpython-4e519377b1b84c9414a360961276993d24198825.tar.gz
cpython-4e519377b1b84c9414a360961276993d24198825.tar.bz2
cpython-4e519377b1b84c9414a360961276993d24198825.zip
bpo-23855: Add missing NULL checks for malloc() in _msi.c (GH-9038)
Diffstat (limited to 'PC')
-rw-r--r--PC/_msi.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/PC/_msi.c b/PC/_msi.c
index 000d81f139f..024b2d3c9fd 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -330,6 +330,10 @@ msierror(int status)
code = MsiRecordGetInteger(err, 1); /* XXX code */
if (MsiFormatRecord(0, err, res, &size) == ERROR_MORE_DATA) {
res = malloc(size+1);
+ if (res == NULL) {
+ MsiCloseHandle(err);
+ return PyErr_NoMemory();
+ }
MsiFormatRecord(0, err, res, &size);
res[size]='\0';
}
@@ -560,6 +564,9 @@ summary_getproperty(msiobj* si, PyObject *args)
&fval, sval, &ssize);
if (status == ERROR_MORE_DATA) {
sval = malloc(ssize);
+ if (sval == NULL) {
+ return PyErr_NoMemory();
+ }
status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival,
&fval, sval, &ssize);
}