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/client.c | |
| parent | 846f724983f098541df0d6f44b1a617b60602aa2 (diff) | |
rio: check the return value of malloc(3)
Diffstat (limited to 'src/cmd/rio/client.c')
| -rw-r--r-- | src/cmd/rio/client.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/rio/client.c b/src/cmd/rio/client.c index 256261ca..d78be626 100644 --- a/src/cmd/rio/client.c +++ b/src/cmd/rio/client.c @@ -151,6 +151,11 @@ getclient(Window w, int create) return 0; c = (Client *)malloc(sizeof(Client)); + if (!c){ + fprintf(stderr, "rio: Failed to allocate memory\n"); + exit(1); + } + memset(c, 0, sizeof(Client)); c->window = w; /* c->parent will be set by the caller */ |