From f7f454524d711624f44eedfc84c2eeab0c144c56 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Wed, 21 Jan 2004 17:01:27 +0000 Subject: check memory allocation --- src/Shape.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Shape.cc b/src/Shape.cc index de03ab2..dda869c 100644 --- a/src/Shape.cc +++ b/src/Shape.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Shape.cc,v 1.9 2004/01/11 15:02:11 fluxgen Exp $ +// $Id: Shape.cc,v 1.10 2004/01/21 17:01:27 fluxgen Exp $ #include "Shape.hh" @@ -62,6 +62,9 @@ FbTk::FbPixmap *createShape(FbTk::FbWindow &win, int place) { // we use calloc here so we get consistent C alloc/free with XDestroyImage // and no warnings in valgrind :) char *data = (char *)calloc(data_size, sizeof (char)); + if (data == 0) + return 0; + memset(data, 0xFF, data_size); XImage *ximage = XCreateImage(disp, -- cgit v0.11.2