Skip to content

Commit

Permalink
Use nothrow new[] to allocate buffer in DRB.
Browse files Browse the repository at this point in the history
This allows us to handle failures to allocate the potentially large
buffers without the program exiting when compiled with exceptions
enabled (the default).
  • Loading branch information
daniel-kristjansson committed Jan 2, 2013
1 parent 032f290 commit 75e5530
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/DeviceReadBuffer.cpp
Expand Up @@ -98,7 +98,7 @@ bool DeviceReadBuffer::Setup(const QString &streamName, int streamfd,
min(dev_read_size, (size_t)deviceBufferSize) : dev_read_size;
min_read = read_quanta * 4;

buffer = new unsigned char[size + dev_read_size];
buffer = new (nothrow) unsigned char[size + dev_read_size];
readPtr = buffer;
writePtr = buffer;
endPtr = buffer + size;
Expand Down

0 comments on commit 75e5530

Please sign in to comment.