From 0530d278e7f209a4f911d0a362177c694eb9368b Mon Sep 17 00:00:00 2001 From: fluxgen Date: Tue, 14 Mar 2006 20:19:33 +0000 Subject: fixed memory leak when XCreateImage fail, thanks php-coder --- src/FbTk/XFontImp.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/FbTk/XFontImp.cc b/src/FbTk/XFontImp.cc index d4d6bd5..2e69308 100644 --- a/src/FbTk/XFontImp.cc +++ b/src/FbTk/XFontImp.cc @@ -221,7 +221,7 @@ void XFontImp::rotate(float angle) { boxlen/2 - descent, text, 1); // reserve memory for first XImage - vertdata = new unsigned char[vert_len * vert_h]; + vertdata = (unsigned char *)calloc((unsigned)(vert_len * vert_h), 1); XImage *I1 = XCreateImage(dpy, DefaultVisual(dpy, screen), 1, XYBitmap, @@ -229,7 +229,11 @@ void XFontImp::rotate(float angle) { vert_w, vert_h, 8, 0); if (I1 == None) { - cerr<<"RotFont: "<<_FBTKTEXT(Error, CreateXImage, "Cant create XImage", "XCreateImage failed for some reason")<<"."<