Silence spurious warning from gcc

This commit is contained in:
Kovid Goyal 2023-01-27 14:44:23 +05:30
parent 65885f505e
commit 17450ddc1c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -655,12 +655,13 @@ bzz_decompress(PyObject *self, PyObject *args) {
if (state.xsize > 0) { if (state.xsize > 0) {
while (buflen - (pos - buf) <= state.xsize) { while (buflen - (pos - buf) <= state.xsize) {
size_t xpos = pos - buf;
tmp = (char*) realloc(buf, buflen + (buflen * sizeof(char))); tmp = (char*) realloc(buf, buflen + (buflen * sizeof(char)));
if (tmp == NULL) { if (tmp == NULL) {
PyErr_NoMemory(); goto end; PyErr_NoMemory(); goto end;
} }
buflen += buflen * sizeof(char); buflen += buflen * sizeof(char);
pos = tmp + (pos - buf); pos = tmp + xpos;
buf = tmp; tmp = NULL; buf = tmp; tmp = NULL;
} }
memcpy(pos, state.buf, state.xsize); memcpy(pos, state.buf, state.xsize);