Don't memcpy null pointer

This commit is contained in:
Dominic Clark
2019-01-19 15:57:57 +00:00
parent 227e88a347
commit 1faaf008c8

View File

@@ -54,8 +54,10 @@ void Alg_atoms::expand()
maxlen += (maxlen >> 2); // add 25%
char **new_atoms = new Alg_attribute[maxlen];
// now do copy
memcpy(new_atoms, atoms, len * sizeof(Alg_attribute));
if (atoms) delete[] atoms;
if (atoms) {
memcpy(new_atoms, atoms, len * sizeof(Alg_attribute));
delete[] atoms;
}
atoms = new_atoms;
}