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/main.c | |
| parent | 846f724983f098541df0d6f44b1a617b60602aa2 (diff) | |
| download | plan9port-ffbdd1aa20c8a20a8e9dcd3cec644b6dfa3c6acb.tar.gz plan9port-ffbdd1aa20c8a20a8e9dcd3cec644b6dfa3c6acb.zip | |
rio: check the return value of malloc(3)
Diffstat (limited to 'src/cmd/rio/main.c')
| -rw-r--r-- | src/cmd/rio/main.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/rio/main.c b/src/cmd/rio/main.c index 1e0b3797..09c1316e 100644 --- a/src/cmd/rio/main.c +++ b/src/cmd/rio/main.c @@ -213,6 +213,10 @@ main(int argc, char *argv[]) num_screens = ScreenCount(dpy); screens = (ScreenInfo *)malloc(sizeof(ScreenInfo) * num_screens); + if (!screens){ + fprintf(stderr, "rio: Failed to allocate memory\n"); + return 1; + } for(i = 0; i < num_screens; i++) initscreen(&screens[i], i, background); |
