Skip to content

Commit

Permalink
Adds free(cl->lastError)
Browse files Browse the repository at this point in the history
Trying to make fuzzing test pass
  • Loading branch information
nicmorais committed May 12, 2024
1 parent fa40867 commit 77243d3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libvncserver/rfbserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ rfbClientConnectionGone(rfbClientPtr cl)
rfbPrintStats(cl);
rfbResetStats(cl);

if(cl->lastError)
free(cl->lastError);
free(cl);
}

Expand Down

3 comments on commit 77243d3

@RokerHRO
Copy link

Choose a reason for hiding this comment

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

an unconditional free(c1->lastError); would do the same.

https://en.cppreference.com/w/c/memory/free

@nicmorais
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @RokerHRO . I think I got too used with checking if the pointer is null before accessing...

@RokerHRO
Copy link

Choose a reason for hiding this comment

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

Better one unnecessary check than a missing chat that would have been necessary. ;-)

Please sign in to comment.