fix memory errors
This commit is contained in:
parent
ab1a12b174
commit
4fbe322fa6
|
@ -274,7 +274,7 @@ static void handle_touch_up(struct wl_listener *listener, void *data) {
|
||||||
static void handle_touch_down(struct wl_listener *listener, void *data) {
|
static void handle_touch_down(struct wl_listener *listener, void *data) {
|
||||||
struct sample_state *sample = wl_container_of(listener, sample, touch_down);
|
struct sample_state *sample = wl_container_of(listener, sample, touch_down);
|
||||||
struct wlr_event_touch_down *event = data;
|
struct wlr_event_touch_down *event = data;
|
||||||
struct touch_point *point = calloc(1, sizeof(struct touch_state));
|
struct touch_point *point = calloc(1, sizeof(struct touch_point));
|
||||||
point->slot = event->slot;
|
point->slot = event->slot;
|
||||||
point->x = event->x_mm / event->width_mm;
|
point->x = event->x_mm / event->width_mm;
|
||||||
point->y = event->y_mm / event->height_mm;
|
point->y = event->y_mm / event->height_mm;
|
||||||
|
|
|
@ -61,7 +61,7 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts
|
||||||
static void handle_touch_down(struct touch_state *tstate, int32_t slot,
|
static void handle_touch_down(struct touch_state *tstate, int32_t slot,
|
||||||
double x, double y, double width, double height) {
|
double x, double y, double width, double height) {
|
||||||
struct sample_state *sample = tstate->compositor->data;
|
struct sample_state *sample = tstate->compositor->data;
|
||||||
struct touch_point *point = calloc(1, sizeof(struct touch_state));
|
struct touch_point *point = calloc(1, sizeof(struct touch_point));
|
||||||
point->slot = slot;
|
point->slot = slot;
|
||||||
point->x = x / width;
|
point->x = x / width;
|
||||||
point->y = y / height;
|
point->y = y / height;
|
||||||
|
|
|
@ -51,6 +51,7 @@ struct wlr_cursor *wlr_cursor_init() {
|
||||||
cur->state = calloc(1, sizeof(struct wlr_cursor_state));
|
cur->state = calloc(1, sizeof(struct wlr_cursor_state));
|
||||||
if (!cur->state) {
|
if (!cur->state) {
|
||||||
wlr_log(L_ERROR, "Failed to allocate wlr_cursor_state");
|
wlr_log(L_ERROR, "Failed to allocate wlr_cursor_state");
|
||||||
|
free(cur);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue