Plug leak

This commit is contained in:
Soren Sandmann Pedersen 2008-06-13 20:01:24 +00:00
parent 90393cdbcc
commit 6585c95b7d
2 changed files with 63 additions and 1 deletions

56
leakfix.patch Normal file
View File

@ -0,0 +1,56 @@
commit 29d144712e558aaeb49f4384028dd669d76a410b
Author: Maximilian Grothusmann <maxi@own-hero.net>
Date: Fri Jun 13 12:44:50 2008 -0700
Fix memory leak by freeing boxes{16,32}.
After calling pixman_region_init_rects() or
pixman_region32_init_rects(), boxes{16,32} were not freed before
returning. Fixes bug 16312.
diff --git a/pixman/pixman-region16.c b/pixman/pixman-region16.c
index 1a0edfe..869e18d 100644
--- a/pixman/pixman-region16.c
+++ b/pixman/pixman-region16.c
@@ -47,6 +47,7 @@ pixman_region16_copy_from_region32 (pixman_region16_t *dst,
int n_boxes, i;
pixman_box32_t *boxes32;
pixman_box16_t *boxes16;
+ pixman_bool_t retval;
boxes32 = pixman_region32_rectangles (src, &n_boxes);
@@ -64,7 +65,9 @@ pixman_region16_copy_from_region32 (pixman_region16_t *dst,
}
pixman_region_fini (dst);
- return pixman_region_init_rects (dst, boxes16, n_boxes);
+ retval = pixman_region_init_rects (dst, boxes16, n_boxes);
+ free (boxes16);
+ return retval;
}
#include "pixman-region.c"
diff --git a/pixman/pixman-region32.c b/pixman/pixman-region32.c
index 4b5598d..6e083b5 100644
--- a/pixman/pixman-region32.c
+++ b/pixman/pixman-region32.c
@@ -45,6 +45,7 @@ pixman_region32_copy_from_region16 (pixman_region32_t *dst,
int n_boxes, i;
pixman_box16_t *boxes16;
pixman_box32_t *boxes32;
+ pixman_bool_t retval;
boxes16 = pixman_region_rectangles (src, &n_boxes);
@@ -62,7 +63,9 @@ pixman_region32_copy_from_region16 (pixman_region32_t *dst,
}
pixman_region32_fini (dst);
- return pixman_region32_init_rects (dst, boxes32, n_boxes);
+ retval = pixman_region32_init_rects (dst, boxes32, n_boxes);
+ free (boxes32);
+ return retval;
}
#include "pixman-region.c"

View File

@ -3,7 +3,7 @@
Name: pixman
Version: 0.11.4
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Pixel manipulation library
Group: System Environment/Libraries
@ -16,6 +16,8 @@ Source0: pixman-%{version}.tar.gz
Source1: make-pixman-snapshot.sh
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Patch0: leakfix.patch
# BuildRequires: automake autoconf libtool pkgconfig
%description
@ -32,6 +34,7 @@ Development library for pixman.
%prep
%setup -q
%patch0 -p1 -b .leakfix
%build
%configure --disable-static
@ -61,6 +64,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/pkgconfig/pixman-1.pc
%changelog
* Fri Jun 13 2008 Soren Sandmann <sandmann@redhat.com> 0.11.4-2
- Plug bad leak (cherrypicked from master)
* Mon Jun 9 2008 Soren Sandmann <sandmann@redhat.com> 0.11.4-1
- Update to 0.11.4