Merge pull request #287 from cgohlke/patch-1

Allocate enough memory to hold pointers
This commit is contained in:
Alex Clark ☺ 2013-07-13 18:23:46 -07:00
commit 1841fbacf3

View File

@ -534,7 +534,7 @@ static unsigned int** get_qtables_arrays(PyObject* qtables) {
PyErr_SetString(PyExc_ValueError, "Not a valid numbers of quantization tables. Should be between 2 and 4."); PyErr_SetString(PyExc_ValueError, "Not a valid numbers of quantization tables. Should be between 2 and 4.");
return NULL; return NULL;
} }
qarrays = (unsigned int**) PyMem_Malloc(num_tables * sizeof(unsigned int)); qarrays = (unsigned int**) PyMem_Malloc(num_tables * sizeof(unsigned int*));
if (!qarrays) { if (!qarrays) {
Py_DECREF(tables); Py_DECREF(tables);
PyErr_NoMemory(); PyErr_NoMemory();