summaryrefslogtreecommitdiff
path: root/graphics/plotutils/files/patch-libplot-x_afftext.c
blob: 4bfba35c51fc7f97435bb361d7218c58b5c05b42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--- libplot/x_afftext.c.orig	2008-07-16 00:54:10 UTC
+++ libplot/x_afftext.c
@@ -185,7 +185,10 @@ XAffCreateAffinedText (Display *dpy, XFontStruct *font
   /* invert transformation matrix */
   det = aa[0] * aa[3] - aa[1] * aa[2];
   if (det == 0.0)
+  {
+    free(afftext);
     return NULL;		/* don't support singular matrices */
+  }
   a_inverse[0] =   aa[3] / det;
   a_inverse[1] = - aa[1] / det;
   a_inverse[2] = - aa[2] / det;
@@ -205,7 +208,10 @@ XAffCreateAffinedText (Display *dpy, XFontStruct *font
   
   /* paranoia */
   if (size_in.x == 0 || size_in.y == 0)
+  {
+    free(afftext);
     return NULL;
+  }
 
   /* work around a possible bug: some X displays can't create pixmaps that
      are only one pixel wide or high */
@@ -238,7 +244,10 @@ XAffCreateAffinedText (Display *dpy, XFontStruct *font
   /* create local image */
   im_in = XAffCreateXImage (dpy, size_in);
   if (im_in == NULL)
+  {
+    free(afftext);
     return NULL;
+  }
 
   /* copy bitmap to it */
   XGetSubImage (dpy, bitmap_in, 0, 0, size_in.x, size_in.y,
@@ -308,7 +317,10 @@ XAffCreateAffinedText (Display *dpy, XFontStruct *font
   /* create 2nd image, to hold affinely transformed text */
   im_out = XAffCreateXImage (dpy, size_out);
   if (im_out == NULL)
+  {
+    free(afftext);
     return NULL;
+  }
     
   /* copy from 1st image to this new one */