Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server/gamestate): memory leak #3063

Merged

Conversation

tens0rfl0w
Copy link
Contributor

Goal of this PR

This PR addresses an issue where creating an object, ped, or vehicle via server-setters does not validate the availability of free object IDs. This oversight can lead to memory leaks and undefined behavior, as overwriting an existing entity handle keeps the previous entity pointer alive in the sync pool, resulting in "ghost entities" and inaccessible allocated memory.

How is this PR achieving the goal

Checking if we got a valid / free object id, and if not, returning a non-valid GUID ('0') indicating failed creation (Client logic parity).

This PR applies to the following area(s)

Server

Successfully tested on

Game builds: Not applicable

Platforms: Windows (Server)

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

/

@github-actions github-actions bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Jan 12, 2025
Copy link
Contributor

@FabianTerhorst FabianTerhorst left a comment

Choose a reason for hiding this comment

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

Thanks 👍

@FabianTerhorst FabianTerhorst added ready-to-merge This PR is enqueued for merging and removed invalid Requires changes before it's considered valid and can be (re)triaged labels Jan 12, 2025
@csskroubledev
Copy link

Thanks, cannot wait for this to be merged :)

@enzoo27
Copy link

enzoo27 commented Jan 20, 2025

Hi, I have the same problem. What am I supposed to do?

@prikolium-cfx prikolium-cfx merged commit 0d108a3 into citizenfx:master Jan 21, 2025
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR is enqueued for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants