diff options
author | Andrea Canciani <ranma42@gmail.com> | 2012-07-06 09:54:38 +0200 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2012-07-31 16:06:33 +0200 |
commit | b5260909420539d105a2cdecdc575c36e3dca284 (patch) | |
tree | e6bdba0a465103b12d76f8a357807d6ec1c8de83 | |
parent | 9336b3abae543ebe07581ab2f48afd5f9bca2494 (diff) |
Do not leak pixman implementation
The termination function can safely destroy the pixman
implementation. This ensures that the library does not cause memory
leaks if loaded/unloaded and that memory debugging tools like Valgrind
do not report issues.
Fixes dynamic-leak-test.
-rw-r--r-- | pixman/pixman-implementation.c | 10 | ||||
-rw-r--r-- | pixman/pixman-private.h | 3 | ||||
-rw-r--r-- | pixman/pixman.c | 2 |
3 files changed, 14 insertions, 1 deletions
diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c index 77d0906..d1d3d44 100644 --- a/pixman/pixman-implementation.c +++ b/pixman/pixman-implementation.c @@ -115,6 +115,16 @@ _pixman_implementation_create (pixman_implementation_t *delegate, return imp; } +void +_pixman_implementation_destroy (pixman_implementation_t *imp) +{ + if (imp != NULL) + { + _pixman_implementation_destroy (imp->delegate); + free (imp); + } +} + pixman_combine_32_func_t _pixman_implementation_lookup_combiner (pixman_implementation_t *imp, pixman_op_t op, diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 3a2a0ab..8163e93 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -498,6 +498,9 @@ pixman_implementation_t * _pixman_implementation_create (pixman_implementation_t *delegate, const pixman_fast_path_t *fast_paths); +void +_pixman_implementation_destroy (pixman_implementation_t *imp); + pixman_combine_32_func_t _pixman_implementation_lookup_combiner (pixman_implementation_t *imp, pixman_op_t op, diff --git a/pixman/pixman.c b/pixman/pixman.c index aa944e5..b45b4d9 100644 --- a/pixman/pixman.c +++ b/pixman/pixman.c @@ -43,7 +43,7 @@ pixman_init (void) static void pixman_fini (void) { - /* TODO: destroy global_implementation */ + _pixman_implementation_destroy (global_implementation); } SIMPLEOPS_INIT (pixman_init); |