Replace uses of "delete" with "delete[]" where appropriate

This commit is contained in:
rdb 2016-03-24 23:56:12 +01:00
parent ad350a207e
commit ce947adf8f
4 changed files with 5 additions and 6 deletions

View File

@ -283,7 +283,7 @@ ns_get_environment_variable(const string &var) const {
if (item != NULL) {
if (PyUnicode_Check(item)) {
Py_ssize_t size = PyUnicode_GetSize(item);
wchar_t *data = new wchar_t[size + 1];
wchar_t *data = (wchar_t *)alloca(sizeof(wchar_t) * (size + 1));
#if PY_MAJOR_VERSION >= 3
if (PyUnicode_AsWideChar(item, data, size) != -1) {
#else
@ -292,7 +292,6 @@ ns_get_environment_variable(const string &var) const {
wstring wstr (data, size);
main_dir = Filename::from_os_specific_w(wstr);
}
delete data;
}
#if PY_MAJOR_VERSION < 3
else if (PyString_Check(item)) {

View File

@ -122,7 +122,7 @@ int PipeStreamBuf::underflow(void) {
#endif /* PHAVE_IOSTREAM */
gbump(-((int)n));
}
delete buf;
delete[] buf;
return ret;
}

View File

@ -41,7 +41,7 @@ check_crc(Filename name) {
unsigned long crc = crc32(0L, Z_NULL, 0);
crc = crc32(crc, (unsigned char *)buffer, buffer_length);
delete buffer;
delete[] buffer;
return crc;
}
@ -67,7 +67,7 @@ check_adler(Filename name) {
unsigned long adler = adler32(0L, Z_NULL, 0);
adler = adler32(adler, (unsigned char *)buffer, buffer_length);
delete buffer;
delete[] buffer;
return adler;
}

View File

@ -333,7 +333,7 @@ write_data(xel *array, xelval *) {
row_pointer[0] = row;
(void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
}
delete row;
delete[] row;
/* Step 6: Finish compression */