sio_sine example: check memory allocation

This commit is contained in:
Andrew Kelley 2016-06-29 16:11:37 -07:00
parent 552167fa0e
commit 1b332a44a0

View file

@ -209,6 +209,11 @@ int main(int argc, char **argv) {
} }
struct SoundIoOutStream *outstream = soundio_outstream_create(device); struct SoundIoOutStream *outstream = soundio_outstream_create(device);
if (!outstream) {
fprintf(stderr, "out of memory\n");
return 1;
}
outstream->write_callback = write_callback; outstream->write_callback = write_callback;
outstream->underflow_callback = underflow_callback; outstream->underflow_callback = underflow_callback;
outstream->name = stream_name; outstream->name = stream_name;