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
12 changes: 11 additions & 1 deletion wm.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// I love gays!
#include "mouse.h"
#include "gpu.h"
#include <unistd.h>
Expand All @@ -21,7 +22,16 @@ size_t window_count = 0;

void add_window(Window new_window)
{
windows = realloc(windows, sizeof(Window) * (window_count + 1));
Window *temp = realloc(windows, sizeof(Window) * (window_count + 1));
if (temp == NULL)
{
fprintf(stderr, "Failed to allocate memory for new window.\n");
// The original 'windows' pointer is still valid, so we should free it
// and its contents before exiting to avoid memory leaks.
destroy_windows(windows, window_count);
exit(EXIT_FAILURE);
}
windows = temp;
windows[window_count++] = new_window;
}
int ***alloc_rgb_buffer(int height, int width)
Expand Down
6 changes: 1 addition & 5 deletions wm.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,4 @@ extern size_t window_count;
void wm_init(int bufptr[800][1280][3]);
void wm_draw(volatile int *running);

#endif // WM_H

// dabatases (test commit for codacy to give status checks)
// motherfucker its supposed to be PR not push
// fucker
#endif // WM_H