backend autocreate: fix leak when WLR_BACKENDS is set

Found through static analysis
This commit is contained in:
Dominique Martinet 2018-06-30 11:11:06 +09:00
parent 1940c6bbd9
commit e5348ad7d3
1 changed files with 3 additions and 0 deletions

View File

@ -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_backend_destroy(backend);
wlr_session_destroy(session);
free(names);
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_backend_destroy(backend);
wlr_session_destroy(session);
free(names);
return NULL;
}
name = strtok_r(NULL, ",", &saveptr);
}
free(names);
return backend;
}