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 ef991b17: server was trying to free() a packet created with "new CommandPacket()" #9334

Merged
merged 1 commit into from Jun 3, 2021

Conversation

TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Jun 3, 2021

Motivation / Problem

GCC analyzer complained about us being a bad boy.

==19244==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs free) on 0x6070002a4fc0
    #0 0x7f51d1ec17cf in __interceptor_free (/lib/x86_64-linux-gnu/libasan.so.5+0x10d7cf)
    #1 0x55de60866b8f in NetworkHandleCommandQueue OpenTTD/src/network/network_server.cpp:1761

0x6070002a4fc0 is located 0 bytes inside of 80-byte region [0x6070002a4fc0,0x6070002a5010)
allocated by thread T0 here:
    #0 0x7f51d1ec3947 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.5+0x10f947)
    #1 0x55de607e8e36 in CommandQueue::Append(CommandPacket*) OpenTTD/src/network/network_command.cpp:59

Description

Introduced in ef991b1 (tnx @glx22 for checking out what revision it was).

Limitations

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@glx22
Copy link
Contributor

glx22 commented Jun 3, 2021

It was added in ef991b1 I think.

@TrueBrain TrueBrain changed the title Fix: server was trying to free() a packet created with "new CommandPacket()" Fix ef991b17: server was trying to free() a packet created with "new CommandPacket()" Jun 3, 2021
@frosch123
Copy link
Member

network.cpp:1075 is the same thing?

@TrueBrain TrueBrain merged commit 5e44da3 into OpenTTD:master Jun 3, 2021
@TrueBrain TrueBrain deleted the fix-server-free-with-new branch June 3, 2021 20:07
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.

None yet

3 participants