diff options
| author | Tom Schwindl <schwindl@posteo.de> | 2022-09-10 15:18:31 +0200 |
|---|---|---|
| committer | Dan Cross <crossd@gmail.com> | 2022-09-12 10:35:36 -0400 |
| commit | ffbdd1aa20c8a20a8e9dcd3cec644b6dfa3c6acb (patch) | |
| tree | f2d979141f7fa69bb112eac51e1652cc7fab4874 /src/cmd/rio/manage.c | |
| parent | 846f724983f098541df0d6f44b1a617b60602aa2 (diff) | |
rio: check the return value of malloc(3)
Diffstat (limited to 'src/cmd/rio/manage.c')
| -rw-r--r-- | src/cmd/rio/manage.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/rio/manage.c b/src/cmd/rio/manage.c index b068a101..07c9d479 100644 --- a/src/cmd/rio/manage.c +++ b/src/cmd/rio/manage.c @@ -320,6 +320,11 @@ getcmaps(Client *c) c->cmapwins = cw; c->wmcmaps = (Colormap*)malloc(n*sizeof(Colormap)); + if (!c->wmcmaps){ + fprintf(stderr, "rio: Failed to allocate memory\n"); + exit(1); + } + for(i = 0; i < n; i++){ if(cw[i] == c->window) c->wmcmaps[i] = c->cmap; |