Skip to content

Commit

Permalink
GUACAMOLE-377: Remove superfluous bounds check (now part of guac_pool).
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-jumper committed Sep 28, 2024
1 parent e47c7f8 commit f4d7f3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
6 changes: 1 addition & 5 deletions src/libguac/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,7 @@ guac_stream* guac_client_alloc_stream(guac_client* client) {
guac_stream* allocd_stream;
int stream_index;

/* Refuse to allocate beyond maximum */
if (client->__stream_pool->active == GUAC_CLIENT_MAX_STREAMS)
return NULL;

/* Allocate stream */
/* Allocate stream, but refuse to allocate beyond maximum */
stream_index = guac_pool_next_int_below_or_die(client->__stream_pool,
GUAC_CLIENT_MAX_STREAMS);

Expand Down
12 changes: 2 additions & 10 deletions src/libguac/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,7 @@ guac_stream* guac_user_alloc_stream(guac_user* user) {
guac_stream* allocd_stream;
int stream_index;

/* Refuse to allocate beyond maximum */
if (user->__stream_pool->active == GUAC_USER_MAX_STREAMS)
return NULL;

/* Allocate stream */
/* Allocate stream, but refuse to allocate beyond maximum */
stream_index = guac_pool_next_int_below_or_die(user->__stream_pool,
GUAC_USER_MAX_STREAMS);

Expand Down Expand Up @@ -142,11 +138,7 @@ guac_object* guac_user_alloc_object(guac_user* user) {
guac_object* allocd_object;
int object_index;

/* Refuse to allocate beyond maximum */
if (user->__object_pool->active == GUAC_USER_MAX_OBJECTS)
return NULL;

/* Allocate object */
/* Allocate object, but refuse to allocate beyond maximum */
object_index = guac_pool_next_int_below_or_die(user->__object_pool,
GUAC_USER_MAX_OBJECTS);

Expand Down

0 comments on commit f4d7f3a

Please sign in to comment.