Skip to content

Commit

Permalink
Don't memcpy null pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
DomClark committed Jan 19, 2019
1 parent 30e44b7 commit e60e1d2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/MidiImport/portsmf/allegro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit e60e1d2

Please sign in to comment.