* Add missing NULL check reported by Svace static analyzer.
* Fix clear_wstrlist() call on a wrong list.
(cherry picked from commit
eb746dbae8b320758ee08f811316d7f283435cc0)
Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
assert((len > 0 && list != NULL) || len == 0);
size_t size = len * sizeof(list[0]);
wchar_t **list_copy = PyMem_RawMalloc(size);
+ if (list_copy == NULL) {
+ return NULL;
+ }
for (int i=0; i < len; i++) {
wchar_t* arg = _PyMem_RawWcsdup(list[i]);
if (arg == NULL) {
- clear_wstrlist(i, list);
+ clear_wstrlist(i, list_copy);
return NULL;
}
list_copy[i] = arg;