Permalink
Browse files

Use nothrow new[] to allocate buffer in DRB.

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...
1 parent 032f290 commit 75e5530925ecf2d4161036ef23b088b9fd4dccb8 @daniel-kristjansson daniel-kristjansson committed Jan 2, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 mythtv/libs/libmythtv/recorders/DeviceReadBuffer.cpp
@@ -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;

0 comments on commit 75e5530

Please sign in to comment.