From 1faaf008c8c32ce0b77c8e48808c0e321943aa40 Mon Sep 17 00:00:00 2001 From: Dominic Clark Date: Sat, 19 Jan 2019 15:57:57 +0000 Subject: [PATCH] Don't memcpy null pointer --- plugins/MidiImport/portsmf/allegro.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/MidiImport/portsmf/allegro.cpp b/plugins/MidiImport/portsmf/allegro.cpp index 653ff4c07..3f7b84073 100644 --- a/plugins/MidiImport/portsmf/allegro.cpp +++ b/plugins/MidiImport/portsmf/allegro.cpp @@ -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; }