From 9e332ab95b7183faa28147b87cf604fbfeb9dcbf Mon Sep 17 00:00:00 2001 From: "stefan@webrtc.org" Date: Tue, 24 Jan 2012 16:33:27 +0000 Subject: [PATCH] Make sure we check the return value from shmat(). BUG= TEST= Review URL: https://webrtc-codereview.appspot.com/358007 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1533 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../video_render/main/source/linux/video_x11_channel.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/video_render/main/source/linux/video_x11_channel.cc b/src/modules/video_render/main/source/linux/video_x11_channel.cc index 027275ce5f..99a69aae98 100644 --- a/src/modules/video_render/main/source/linux/video_x11_channel.cc +++ b/src/modules/video_render/main/source/linux/video_x11_channel.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source @@ -261,6 +261,10 @@ WebRtc_Word32 VideoX11Channel::CreateLocalRenderer(WebRtc_Word32 width, _shminfo.shmid = shmget(IPC_PRIVATE, (_image->bytes_per_line * _image->height), IPC_CREAT | 0777); _shminfo.shmaddr = _image->data = (char*) shmat(_shminfo.shmid, 0, 0); + if (_image->data == reinterpret_cast(-1)) + { + return -1; + } _buffer = (unsigned char*) _image->data; _shminfo.readOnly = False;