Skip to content

Fixed crash when#1223

Open
kaegoorn wants to merge 1 commit intoredis:masterfrom
kaegoorn:patch-1
Open

Fixed crash when#1223
kaegoorn wants to merge 1 commit intoredis:masterfrom
kaegoorn:patch-1

Conversation

@kaegoorn
Copy link
Copy Markdown

@kaegoorn kaegoorn commented Sep 1, 2023

Fixed crash when __redisAsyncFree is called if redisLibuvAttach has not completed

` context = redisAsyncConnect(host, port);

    if (redisLibuvAttach(context, loop) != REDIS_OK)
         redisAsyncFree(context); // <--- crash

`

Fixed crash when __redisAsyncFree is called if redisLibuvAttach has not completed
static void redisLibuvCleanup(void *privdata) {
redisLibuvEvents* p = (redisLibuvEvents*)privdata;

if (p == NULL)
Copy link
Copy Markdown
Contributor

@AgranatMarkit AgranatMarkit Nov 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It's not a good practice, to add such checks, because they could affect performance.
  2. You couldn't check redundant cleanups in client code, if it's needed.
  3. It's better to make early return before casting on line 131.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Mark

  1. This is a best practice to check variables
  2. This is internal function calls from driver
  3. May be

P.s. Марк, ты вообще офигел :)
Я сейчас вспомню Серафим и всякое разное :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As i see, it's better to add check for nullability here, because there are exist another adapters, and their cleanup functions will be also called with NULL privdata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants