summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-09-10 16:41:12 (GMT)
committerGitHub <noreply@github.com>2018-09-10 16:41:12 (GMT)
commitf51a46631f8dcca596c08a934a766da9afe93c06 (patch)
tree95d9fe12329e423c291f00cd31eb0baf1a1f961f
parentbf2bd8f8a1d88de60c114de957f50fe2433e3937 (diff)
downloadcpython-f51a46631f8dcca596c08a934a766da9afe93c06.zip
cpython-f51a46631f8dcca596c08a934a766da9afe93c06.tar.gz
cpython-f51a46631f8dcca596c08a934a766da9afe93c06.tar.bz2
bpo-23855: Add missing NULL checks for malloc() in _msi.c (GH-9038)
(cherry picked from commit 4e519377b1b84c9414a360961276993d24198825) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
-rw-r--r--PC/_msi.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/PC/_msi.c b/PC/_msi.c
index d7700f0..68c4e79 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -321,6 +321,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';
}
@@ -544,6 +548,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);
}