1.1 --- a/libfsclient/lib/src/client.cc Wed Jan 24 00:12:43 2024 +0100
1.2 +++ b/libfsclient/lib/src/client.cc Wed Jan 24 18:09:31 2024 +0100
1.3 @@ -264,11 +264,17 @@
1.4
1.5 file_t *client_get_stream(const char *name, flags_t flags)
1.6 {
1.7 - file_t *stream = (file_t *) malloc(sizeof(file_t));
1.8 + l4_cap_idx_t ref = l4re_env_get_cap(name);
1.9 + file_t *stream;
1.10 +
1.11 + if (l4_is_invalid_cap(ref))
1.12 + return NULL;
1.13 +
1.14 + stream = (file_t *) malloc(sizeof(file_t));
1.15
1.16 file_init(stream);
1.17 stream->flags = flags;
1.18 - stream->ref = l4re_env_get_cap(name);
1.19 + stream->ref = ref;
1.20
1.21 /* Enforce blocking if necessary.
1.22 NOTE: Ignoring any event subscription error. */