backend autocreate: fix leak when WLR_BACKENDS is set

Found through static analysis
master
Dominique Martinet 6 years ago
parent 1940c6bbd9
commit e5348ad7d3

@ -203,6 +203,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
wlr_log(L_ERROR, "failed to start backend '%s'", name); wlr_log(L_ERROR, "failed to start backend '%s'", name);
wlr_backend_destroy(backend); wlr_backend_destroy(backend);
wlr_session_destroy(session); wlr_session_destroy(session);
free(names);
return NULL; return NULL;
} }
@ -210,12 +211,14 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
wlr_log(L_ERROR, "failed to add backend '%s'", name); wlr_log(L_ERROR, "failed to add backend '%s'", name);
wlr_backend_destroy(backend); wlr_backend_destroy(backend);
wlr_session_destroy(session); wlr_session_destroy(session);
free(names);
return NULL; return NULL;
} }
name = strtok_r(NULL, ",", &saveptr); name = strtok_r(NULL, ",", &saveptr);
} }
free(names);
return backend; return backend;
} }

Loading…
Cancel
Save