Browse Source

Fix memory corruption when listing MIDI ports

The array holding the listed MIDI ports was being corrupted if any
of the *_midi_get_ports functions was called more than once, due
to a mishandling of operator priority.
develop
Damien Goutte-Gattat 8 years ago
parent
commit
bd4e5da37c
  1. 4
      src/midi.c

4
src/midi.c

@ -169,7 +169,7 @@ alsa_midi_get_ports(char ***ports, size_t *n, size_t *max)
*max += 10;
*ports = xrealloc(*ports, *max);
}
*ports[(*n)++] = xstrdup(name);
(*ports)[(*n)++] = xstrdup(name);
}
snd_ctl_close(ctl);
@ -274,7 +274,7 @@ oss_midi_get_ports(char ***ports, size_t *n, size_t *max)
*max += 10;
*ports = xrealloc(*ports, *max);
}
ports[(*n)++] = xstrdup(name);
(*ports)[(*n)++] = xstrdup(name);
}
}
}

Loading…
Cancel
Save