Skip to content

Commit

Permalink
missed an old pointer to be freed
Browse files Browse the repository at this point in the history
  • Loading branch information
psi29a committed May 15, 2018
1 parent cb85b69 commit 7801a34
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/internal_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,11 @@ static void _WM_CheckEventMemoryPool(struct _mdi *mdi) {
if ((mdi->event_count + 1) >= mdi->events_size) {
struct _event * new_events;
mdi->events_size += MEM_CHUNK;
new_events = (struct _event *) realloc(mdi->events,
(mdi->events_size * sizeof(struct _event)));
new_events = (struct _event *)
realloc(mdi->events, (mdi->events_size * sizeof(struct _event)));
if (!new_events){
_WM_GLOBAL_ERROR(__FUNCTION__, __LINE__, WM_ERR_MEM, "Unable to reallocate memory.", 0);
free(mdi->events);
return;
}
mdi->events = new_events;
Expand Down

2 comments on commit 7801a34

@sezero
Copy link
Contributor

@sezero sezero commented on 7801a34 May 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, this is not enough for anything: no one is checking the failure in _WM_CheckEventMemoryPool(). The whole thing needs a careful audit.

@psi29a
Copy link
Member Author

@psi29a psi29a commented on 7801a34 May 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I commented on that in the PR itself. We need to notify the library user (application) that there was an issue so they can retry (after freeing up RAM).

Please sign in to comment.