Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/image-gif.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,18 @@ static twin_animation_t *_twin_animation_from_gif_file(const char *path)

anim->n_frames = frame_count;
anim->frames = malloc(sizeof(twin_pixmap_t *) * frame_count);
if (!anim->frames) {
free(anim);
gif_close(gif);
return NULL;
}
anim->frame_delays = malloc(sizeof(twin_time_t) * frame_count);
if (!anim->frame_delays) {
free(anim->frames);
free(anim);
gif_close(gif);
return NULL;
}

gif_rewind(gif);
uint8_t *color, *frame;
Expand Down
2 changes: 2 additions & 0 deletions src/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,8 @@ twin_path_t *twin_path_create(void)
twin_path_t *path;

path = malloc(sizeof(twin_path_t));
if (!path)
return NULL;
path->npoints = path->size_points = 0;
path->nsublen = path->size_sublen = 0;
path->points = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/poly.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ void twin_fill_path(twin_pixmap_t *pixmap,

int nalloc = path->npoints + path->nsublen + 1;
twin_edge_t *edges = malloc(sizeof(twin_edge_t) * nalloc);
if (!edges)
return;
int p = 0;
int nedges = 0;
for (int s = 0; s <= path->nsublen; s++) {
Expand Down
2 changes: 2 additions & 0 deletions src/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ void twin_window_set_name(twin_window_t *window, const char *name)
window->name = malloc(strlen(name) + 1);
if (window->name)
strcpy(window->name, name);
else
window->name = NULL; /* Ensure consistent state on allocation failure */
twin_window_draw(window);
}

Expand Down