Skip to content

fix: some nulls checks - #840

Merged
levb merged 4 commits into
nats-io:mainfrom
wooffie:fix-some-nulls-checks
Feb 18, 2025
Merged

fix: some nulls checks#840
levb merged 4 commits into
nats-io:mainfrom
wooffie:fix-some-nulls-checks

Conversation

@wooffie

@wooffie wooffie commented Feb 18, 2025

Copy link
Copy Markdown
Contributor

3 locations:

  1. nc->cur checked for NULL, but after use it without check
  2. serverUrls can be null and dereferenced in do-while cycle
  3. msg can be null, if sub->draining false. I just added check, maybe someone advice how to fix it better

@levb levb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the fixes, please see the comments inline.

Comment thread src/conn.c
Comment thread src/conn.c Outdated
Comment thread src/sub.c Outdated
@wooffie

wooffie commented Feb 18, 2025

Copy link
Copy Markdown
Contributor Author

@levb in future will bring some more fixies, its better to bring it in one PR, or create small PRs?

@levb

levb commented Feb 18, 2025

Copy link
Copy Markdown
Collaborator

@wooffie Small PRs are best!

@levb levb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@levb
levb merged commit 8943308 into nats-io:main Feb 18, 2025
levb pushed a commit that referenced this pull request Feb 28, 2025
* fix: some nulls checks

* fix: add null check for thread if oci already done

* fix: some nulls checks - remove redundant braces

* fix: some nulls checks - better if for sub.c
@levb levb removed the cherry-pick label Feb 28, 2025
@levb levb mentioned this pull request Feb 28, 2025
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