[PATCH][weston] animation: Fix potential leak of memory pointed to by move
Free move before return if animation is null. Signed-off-by: Lucas Tanure --- src/animation.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/animation.c b/src/animation.c index cc7482d..2c7943f 100644 --- a/src/animation.c +++ b/src/animation.c @@ -471,8 +471,10 @@ weston_move_scale_run(struct weston_view *view, int dx, int dy, animation = weston_view_animation_create(view, start, end, move_frame, NULL, move_done, data, move); - if (animation == NULL) + if (animation == NULL){ + free(move); return NULL; + } weston_spring_init(&animation->spring, 400.0, 0.0, 1.0); animation->spring.friction = 1150; -- 2.6.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH][weston] ivi-layout-transition: Standardize the check for layout_transition_register
Check the return from layout_transition_register in order to fix potential leak of memory pointed to by transition. And don't register a null transition. Signed-off-by: Lucas Tanure --- ivi-shell/ivi-layout-transition.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c index adaa543..483437d 100644 --- a/ivi-shell/ivi-layout-transition.c +++ b/ivi-shell/ivi-layout-transition.c @@ -418,7 +418,9 @@ ivi_layout_transition_move_resize_view(struct ivi_layout_surface *surface, transition_move_resize_view_destroy, duration); - layout_transition_register(transition); + if(transition && layout_transition_register(transition)) + return; + layout_transition_destroy(transition); } /* fade transition */ @@ -512,8 +514,9 @@ create_visibility_transition(struct ivi_layout_surface *surface, destroy_func, duration); - if (!layout_transition_register(transition)) - layout_transition_destroy(transition); + if (transition && layout_transition_register(transition)) + return; + layout_transition_destroy(transition); } static void -- 2.6.0 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH][weston 1/3] ivi-layout-transition: Fix potential leak of memory pointed to by transition
On Wed, Sep 23, 2015 at 9:06 PM, Bryce Harrington wrote: > On Wed, Sep 23, 2015 at 10:33:21AM -0300, Lucas Tanure wrote: > > Free transition in ivi_layout_transition_fade_layer if we fail to > > allocate memory for data > > > > Signed-off-by: Lucas Tanure > > Don't forget spaces after keywords. I.e. "if (" instead of "if(" > > I locally fixed that code style issue, as well as the missing semicolon > on the third patch. Then since the three patches all have the same > title, and are each basically just one-liners, I squashed the whole > collection into one commit. > > commit c8dcd16b01ea0f5ac8f32ee18374b2ca2694dd6c > Author: Lucas Tanure > AuthorDate: Wed Sep 23 10:33:21 2015 -0300 > Commit: Bryce Harrington > CommitDate: Wed Sep 23 17:02:28 2015 -0700 > > ivi-layout-transition: Fix potential leak of memory pointed to by > transition > > Several fixes to handle invalid transition objects: > > 1. Free transition in ivi_layout_transition_fade_layer if we fail to >allocate memory for data > > 2. Check if transition is not null and if layout_transition_register > was >ok before return, if not, free transition > > 3. Destroy transition if layout_transition_register was not ok, we > can't > just free transition, we need to call layout_transition_destroy in >order to free private_data from transition > > Signed-off-by: Lucas Tanure > Reviewed-by: Bryce Harrington > > And pushed to trunk: > > To ssh://git.freedesktop.org/git/wayland/weston >ae5df83..c8dcd16 master -> master > > > > --- > > ivi-shell/ivi-layout-transition.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/ivi-shell/ivi-layout-transition.c > b/ivi-shell/ivi-layout-transition.c > > index 150e301..716dd70 100644 > > --- a/ivi-shell/ivi-layout-transition.c > > +++ b/ivi-shell/ivi-layout-transition.c > > @@ -850,6 +850,7 @@ ivi_layout_transition_fade_layer( > > data = malloc(sizeof(*data)); > > if (data == NULL) { > > weston_log("%s: memory allocation fails\n", __func__); > > + free(transition); > > return; > > } > > > > -- > > 2.5.3 > > > > ___ > > wayland-devel mailing list > > wayland-devel@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/wayland-devel > Ok, sorry, I didn't saw that. I will be more careful. Thanks -- Lucas Tanure +55 (19) 988176559 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH][weston 3/3] ivi-layout-transition: Fix potential leak of memory pointed to by transition
Destroy transition if layout_transition_register was not ok, we can't just free transition, we need to call layout_transition_destroy in order to free private_data from transition Signed-off-by: Lucas Tanure --- ivi-shell/ivi-layout-transition.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c index 507de6d..7b17544 100644 --- a/ivi-shell/ivi-layout-transition.c +++ b/ivi-shell/ivi-layout-transition.c @@ -873,7 +873,8 @@ ivi_layout_transition_fade_layer( data->end_alpha = end_alpha; data->destroy_func = destroy_func; - layout_transition_register(transition); + if(!layout_transition_register(transition)) + layout_transition_destroy(transition) return; } -- 2.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH][weston 1/3] ivi-layout-transition: Fix potential leak of memory pointed to by transition
Free transition in ivi_layout_transition_fade_layer if we fail to allocate memory for data Signed-off-by: Lucas Tanure --- ivi-shell/ivi-layout-transition.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c index 150e301..716dd70 100644 --- a/ivi-shell/ivi-layout-transition.c +++ b/ivi-shell/ivi-layout-transition.c @@ -850,6 +850,7 @@ ivi_layout_transition_fade_layer( data = malloc(sizeof(*data)); if (data == NULL) { weston_log("%s: memory allocation fails\n", __func__); + free(transition); return; } -- 2.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH][weston 2/3] ivi-layout-transition: Fix potential leak of memory pointed to by transition
Check if transition is not null and if layout_transition_register was ok before return, if not, free transition Signed-off-by: Lucas Tanure --- ivi-shell/ivi-layout-transition.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c index 716dd70..507de6d 100644 --- a/ivi-shell/ivi-layout-transition.c +++ b/ivi-shell/ivi-layout-transition.c @@ -746,9 +746,10 @@ ivi_layout_transition_move_layer(struct ivi_layout_layer *layer, NULL, NULL, duration); - layout_transition_register(transition); + if(transition && layout_transition_register(transition)) + return; - return; + free(transition); } void -- 2.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH][weston] ivi_layout_surface_add_notification: Fix potential leak of memory pointed to by 'notification'
Ok. Thanks, I forgot that one. On Tue, Sep 22, 2015, 21:18 Bryce Harrington wrote: > On Tue, Sep 22, 2015 at 05:18:05PM -0700, Bryce Harrington wrote: > > On Sat, Sep 19, 2015 at 06:24:58PM -0300, Lucas Tanure wrote: > > > Signed-off-by: Lucas Tanure > > > > Reviewed-by: Bryce Harrington > > > > I notice this patch was marked as Superseded in patchwork, but I didn't > > spot a patch superseding it. So, I've NEW'd it for application since it > > still appears to be pertinent. > > > > Thanks, > > Bryce > > remote: I: patch #59941 updated using rev > 193c7a54a82995c87cdded798dc7db33c90763de > remote: I: 1 patch(es) updated to state Accepted. > To ssh://git.freedesktop.org/git/wayland/weston >96db077..193c7a5 master -> master > > > > --- > > > ivi-shell/ivi-layout.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c > > > index 24bd8dd..061f156 100644 > > > --- a/ivi-shell/ivi-layout.c > > > +++ b/ivi-shell/ivi-layout.c > > > @@ -1532,6 +1532,7 @@ ivi_layout_surface_add_notification(struct > ivi_layout_surface *ivisurf, > > > prop_callback = malloc(sizeof *prop_callback); > > > if (prop_callback == NULL) { > > > weston_log("fails to allocate memory\n"); > > > + free(notification); > > > return IVI_FAILED; > > > } > > > > > > -- > > > 2.5.3 > > > > > > ___ > > > wayland-devel mailing list > > > wayland-devel@lists.freedesktop.org > > > http://lists.freedesktop.org/mailman/listinfo/wayland-devel > > ___ > > wayland-devel mailing list > > wayland-devel@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/wayland-devel > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH][weston 1/2] ivi-layout-transition: Change layout_transition_register return type
On Tue, Sep 22, 2015 at 6:38 PM, Bryce Harrington wrote: > On Tue, Sep 22, 2015 at 02:36:44PM -0700, Bryce Harrington wrote: > > On Mon, Sep 21, 2015 at 02:10:32PM -0300, Lucas Tanure wrote: > > > layout_transition_register could not work and we need to free trans in > > > the calling function. > > > > > > Signed-off-by: Lucas Tanure > > > > LGTM, > > > > Reviewed-by: Bryce Harrington > > Both patches landed, along with the other ivi-layout-transition patch. > > remote: I: patch #60019 updated using rev > 9af00170771fe010df1bab2501fcbfb98ebfc5e0 > remote: I: patch #60031 updated using rev > 9b5fe423bf7f4f23872a6d678d261b7f995fbd52 > remote: I: patch #60032 updated using rev > 96db07741f375e28442cbcd3a6471f370da055de > remote: I: 3 patch(es) updated to state Accepted. > To ssh://git.freedesktop.org/git/wayland/weston >8c15360..96db077 master -> master > > > > > --- > > > ivi-shell/ivi-layout-transition.c | 6 -- > > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > > > diff --git a/ivi-shell/ivi-layout-transition.c > b/ivi-shell/ivi-layout-transition.c > > > index 6370e8f..8d477b4 100644 > > > --- a/ivi-shell/ivi-layout-transition.c > > > +++ b/ivi-shell/ivi-layout-transition.c > > > @@ -27,6 +27,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > > > > #include "ivi-layout-export.h" > > > #include "ivi-layout-private.h" > > > @@ -181,7 +182,7 @@ ivi_layout_transition_set_create(struct > weston_compositor *ec) > > > return transitions; > > > } > > > > > > -static void > > > +static bool > > > layout_transition_register(struct ivi_layout_transition *trans) > > > { > > > struct ivi_layout *layout = get_instance(); > > > @@ -190,11 +191,12 @@ layout_transition_register(struct > ivi_layout_transition *trans) > > > node = malloc(sizeof(*node)); > > > if (node == NULL) { > > > weston_log("%s: memory allocation fails\n", __func__); > > > - return; > > > + return false; > > > } > > > > > > node->transition = trans; > > > wl_list_insert(&layout->pending_transition_list, &node->link); > > > + return true; > > > } > > > > > > static void > > > -- > > > 2.5.3 > > > > > > ___ > > > wayland-devel mailing list > > > wayland-devel@lists.freedesktop.org > > > http://lists.freedesktop.org/mailman/listinfo/wayland-devel > > ___ > > wayland-devel mailing list > > wayland-devel@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/wayland-devel > Thanks! -- Lucas Tanure +55 (19) 988176559 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH][weston 2/2] ivi-layout-transition: Fix potential leak of memory pointed to by transition
Check if layout_transition_register worked, otherwise destroy transition Signed-off-by: Lucas Tanure --- ivi-shell/ivi-layout-transition.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c index 8d477b4..b00b589 100644 --- a/ivi-shell/ivi-layout-transition.c +++ b/ivi-shell/ivi-layout-transition.c @@ -511,7 +511,8 @@ create_visibility_transition(struct ivi_layout_surface *surface, destroy_func, duration); - layout_transition_register(transition); + if(!layout_transition_register(transition)) + layout_transition_destroy(transition); } static void -- 2.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH][weston 1/2] ivi-layout-transition: Change layout_transition_register return type
layout_transition_register could not work and we need to free trans in the calling function. Signed-off-by: Lucas Tanure --- ivi-shell/ivi-layout-transition.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c index 6370e8f..8d477b4 100644 --- a/ivi-shell/ivi-layout-transition.c +++ b/ivi-shell/ivi-layout-transition.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "ivi-layout-export.h" #include "ivi-layout-private.h" @@ -181,7 +182,7 @@ ivi_layout_transition_set_create(struct weston_compositor *ec) return transitions; } -static void +static bool layout_transition_register(struct ivi_layout_transition *trans) { struct ivi_layout *layout = get_instance(); @@ -190,11 +191,12 @@ layout_transition_register(struct ivi_layout_transition *trans) node = malloc(sizeof(*node)); if (node == NULL) { weston_log("%s: memory allocation fails\n", __func__); - return; + return false; } node->transition = trans; wl_list_insert(&layout->pending_transition_list, &node->link); + return true; } static void -- 2.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH][weston, v2] ivi-layout-transition: Fix potential leak of memory pointed to by transition
Free transition before return. We don't need to use layout_transition_destroy, because transition was not registered yet. v2: consolidate memory leaks fixes Signed-off-by: Lucas Tanure --- ivi-shell/ivi-layout-transition.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c index d12a8f4..6370e8f 100644 --- a/ivi-shell/ivi-layout-transition.c +++ b/ivi-shell/ivi-layout-transition.c @@ -340,6 +340,7 @@ create_move_resize_view_transition( data = malloc(sizeof(*data)); if (data == NULL) { weston_log("%s: memory allocation fails\n", __func__); + free(transition); return NULL; } @@ -468,6 +469,7 @@ create_fade_view_transition( data = malloc(sizeof(*data)); if (data == NULL) { weston_log("%s: memory allocation fails\n", __func__); + free(transition); return NULL; } @@ -697,6 +699,7 @@ create_move_layer_transition( data = malloc(sizeof(*data)); if (data == NULL) { weston_log("%s: memory allocation fails\n", __func__); + free(transition); return NULL; } -- 2.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH][weston] vaapi-recorder: Fix allocator sizeof operand mismatch
Result of 'calloc' is converted to a pointer of type 'unsigned int', which is incompatible with sizeof operand type 'int' Signed-off-by: Lucas Tanure --- src/vaapi-recorder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vaapi-recorder.c b/src/vaapi-recorder.c index c93f7b9..1fd7ebe 100644 --- a/src/vaapi-recorder.c +++ b/src/vaapi-recorder.c @@ -141,7 +141,7 @@ static void bitstream_start(struct bitstream *bs) { bs->max_size_in_dword = BITSTREAM_ALLOCATE_STEPPING; - bs->buffer = calloc(bs->max_size_in_dword * sizeof(int), 1); + bs->buffer = calloc(bs->max_size_in_dword * sizeof(unsigned int), 1); bs->bit_offset = 0; } -- 2.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH][weston] ivi-layout-transition: Fix potential leak of memory pointed to by 'transition'
Free transition before return. We don't need to use layout_transition_destroy, because transition was not registered yet. Signed-off-by: Lucas Tanure --- ivi-shell/ivi-layout-transition.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c index 8c5c8cb..6370e8f 100644 --- a/ivi-shell/ivi-layout-transition.c +++ b/ivi-shell/ivi-layout-transition.c @@ -340,6 +340,7 @@ create_move_resize_view_transition( data = malloc(sizeof(*data)); if (data == NULL) { weston_log("%s: memory allocation fails\n", __func__); + free(transition); return NULL; } -- 2.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH][weston] ivi_layout_surface_add_notification: Fix potential leak of memory pointed to by 'notification'
Signed-off-by: Lucas Tanure --- ivi-shell/ivi-layout.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c index 24bd8dd..061f156 100644 --- a/ivi-shell/ivi-layout.c +++ b/ivi-shell/ivi-layout.c @@ -1532,6 +1532,7 @@ ivi_layout_surface_add_notification(struct ivi_layout_surface *ivisurf, prop_callback = malloc(sizeof *prop_callback); if (prop_callback == NULL) { weston_log("fails to allocate memory\n"); + free(notification); return IVI_FAILED; } -- 2.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH][weston] create_fade_view_transition: Fix potential leak of memory pointed to by 'transition'
Free transition before return. We don't need to use layout_transition_destroy, because transition was not registered yet. Signed-off-by: Lucas Tanure --- ivi-shell/ivi-layout-transition.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c index a042976..8c5c8cb 100644 --- a/ivi-shell/ivi-layout-transition.c +++ b/ivi-shell/ivi-layout-transition.c @@ -468,6 +468,7 @@ create_fade_view_transition( data = malloc(sizeof(*data)); if (data == NULL) { weston_log("%s: memory allocation fails\n", __func__); + free(transition); return NULL; } -- 2.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH][weston]ivi-shell-transition: Fix potential leak of memory pointed to by 'transition'
Free transition before return. We don't need to use layout_transition_destroy, because transition was not registered yet. Signed-off-by: Lucas Tanure --- ivi-shell/ivi-layout-transition.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c index d12a8f4..a042976 100644 --- a/ivi-shell/ivi-layout-transition.c +++ b/ivi-shell/ivi-layout-transition.c @@ -697,6 +697,7 @@ create_move_layer_transition( data = malloc(sizeof(*data)); if (data == NULL) { weston_log("%s: memory allocation fails\n", __func__); + free(transition); return NULL; } -- 2.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH][weston] Fix potential leak of memory pointed to by 'transition'
Free transition before return. We don't need to use layout_transition_destroy, because transition was not registered yet. Signed-off-by: Lucas Tanure --- ivi-shell/ivi-layout-transition.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c index d12a8f4..a042976 100644 --- a/ivi-shell/ivi-layout-transition.c +++ b/ivi-shell/ivi-layout-transition.c @@ -697,6 +697,7 @@ create_move_layer_transition( data = malloc(sizeof(*data)); if (data == NULL) { weston_log("%s: memory allocation fails\n", __func__); + free(transition); return NULL; } -- 2.5.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel