tablet-shell: Avoid leaking the path on failed icon loading

dev
Rob Bradford 12 years ago committed by Kristian Høgsberg
parent c9213e7353
commit c48c34d6fa
  1. 2
      clients/tablet-shell.c

@ -396,7 +396,6 @@ tablet_shell_add_launcher(struct tablet *tablet,
struct homescreen *homescreen = tablet->homescreen; struct homescreen *homescreen = tablet->homescreen;
launcher = malloc(sizeof *launcher); launcher = malloc(sizeof *launcher);
launcher->path = strdup(path);
launcher->icon = load_cairo_surface(icon); launcher->icon = load_cairo_surface(icon);
if ( !launcher->icon || if ( !launcher->icon ||
cairo_surface_status (launcher->icon) != CAIRO_STATUS_SUCCESS) { cairo_surface_status (launcher->icon) != CAIRO_STATUS_SUCCESS) {
@ -404,6 +403,7 @@ tablet_shell_add_launcher(struct tablet *tablet,
free(launcher); free(launcher);
return; return;
} }
launcher->path = strdup(path);
launcher->homescreen = homescreen; launcher->homescreen = homescreen;
launcher->widget = widget_add_widget(homescreen->widget, launcher); launcher->widget = widget_add_widget(homescreen->widget, launcher);

Loading…
Cancel
Save