Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2862 closed defect (fixed)

[PATCH] Valgrind warnings on game shutdown

Reported by: Echelon9 Owned by: leper
Priority: Should Have Milestone: Alpha 18
Component: Core engine Keywords: patch valgrind memory uninitialised
Cc: Patch:

Description

Valgrind reports the following conditional jump or move depends on uninitialised value(s) in game shutdown code.

Map loaded was the default, and circa one minute of limited gameplay occurred before hitting Ctrl-C on valgrind to trigger the shutdown code.

Note: valgrind was run with the --smc-check=all argument to silence the Javascript engine false positives.

==367== Conditional jump or move depends on uninitialised value(s)
==367==    at 0x7C8C15: CLOSTexture::DeleteTexture() (LOSTexture.cpp:96)
==367==    by 0x7C8A0C: CLOSTexture::~CLOSTexture() (LOSTexture.cpp:70)
==367==    by 0x7E776B: CGameViewImpl::~CGameViewImpl() (in /home/usera/Coding/0ad/binaries/system/pyrogenesis_dbg)
==367==    by 0x7E09E3: CGameView::~CGameView() (GameView.cpp:377)
==367==    by 0x7E0A6A: CGameView::~CGameView() (GameView.cpp:378)
==367==    by 0x734769: CGame::~CGame() (Game.cpp:100)
==367==    by 0x7622E4: EndGame() (GameSetup.cpp:679)
==367==    by 0x762346: Shutdown(int) (GameSetup.cpp:690)
==367==    by 0x4B4EC3: RunGameOrAtlas(int, char const**) (main.cpp:512)
==367==    by 0x4B51D5: main (main.cpp:555)
==367== 
==367== Conditional jump or move depends on uninitialised value(s)
==367==    at 0x3BF9535B: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x7C8C2B: CLOSTexture::DeleteTexture() (LOSTexture.cpp:97)
==367==    by 0x7C8A0C: CLOSTexture::~CLOSTexture() (LOSTexture.cpp:70)
==367==    by 0x7E776B: CGameViewImpl::~CGameViewImpl() (in /home/usera/Coding/0ad/binaries/system/pyrogenesis_dbg)
==367==    by 0x7E09E3: CGameView::~CGameView() (GameView.cpp:377)
==367==    by 0x7E0A6A: CGameView::~CGameView() (GameView.cpp:378)
==367==    by 0x734769: CGame::~CGame() (Game.cpp:100)
==367==    by 0x7622E4: EndGame() (GameSetup.cpp:679)
==367==    by 0x762346: Shutdown(int) (GameSetup.cpp:690)
==367==    by 0x4B4EC3: RunGameOrAtlas(int, char const**) (main.cpp:512)
==367==    by 0x4B51D5: main (main.cpp:555)
==367== 
==367== Conditional jump or move depends on uninitialised value(s)
==367==    at 0x3BF45C1C: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x3BF95368: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x7C8C2B: CLOSTexture::DeleteTexture() (LOSTexture.cpp:97)
==367==    by 0x7C8A0C: CLOSTexture::~CLOSTexture() (LOSTexture.cpp:70)
==367==    by 0x7E776B: CGameViewImpl::~CGameViewImpl() (in /home/usera/Coding/0ad/binaries/system/pyrogenesis_dbg)
==367==    by 0x7E09E3: CGameView::~CGameView() (GameView.cpp:377)
==367==    by 0x7E0A6A: CGameView::~CGameView() (GameView.cpp:378)
==367==    by 0x734769: CGame::~CGame() (Game.cpp:100)
==367==    by 0x7622E4: EndGame() (GameSetup.cpp:679)
==367==    by 0x762346: Shutdown(int) (GameSetup.cpp:690)
==367==    by 0x4B4EC3: RunGameOrAtlas(int, char const**) (main.cpp:512)
==367==    by 0x4B51D5: main (main.cpp:555)
==367== 
==367== Conditional jump or move depends on uninitialised value(s)
==367==    at 0x3BF45C21: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x3BF95368: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x7C8C2B: CLOSTexture::DeleteTexture() (LOSTexture.cpp:97)
==367==    by 0x7C8A0C: CLOSTexture::~CLOSTexture() (LOSTexture.cpp:70)
==367==    by 0x7E776B: CGameViewImpl::~CGameViewImpl() (in /home/usera/Coding/0ad/binaries/system/pyrogenesis_dbg)
==367==    by 0x7E09E3: CGameView::~CGameView() (GameView.cpp:377)
==367==    by 0x7E0A6A: CGameView::~CGameView() (GameView.cpp:378)
==367==    by 0x734769: CGame::~CGame() (Game.cpp:100)
==367==    by 0x7622E4: EndGame() (GameSetup.cpp:679)
==367==    by 0x762346: Shutdown(int) (GameSetup.cpp:690)
==367==    by 0x4B4EC3: RunGameOrAtlas(int, char const**) (main.cpp:512)
==367==    by 0x4B51D5: main (main.cpp:555)
==367== 
==367== Use of uninitialised value of size 8
==367==    at 0x3BF46286: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x3BF45C2F: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x3BF95368: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x7C8C2B: CLOSTexture::DeleteTexture() (LOSTexture.cpp:97)
==367==    by 0x7C8A0C: CLOSTexture::~CLOSTexture() (LOSTexture.cpp:70)
==367==    by 0x7E776B: CGameViewImpl::~CGameViewImpl() (in /home/usera/Coding/0ad/binaries/system/pyrogenesis_dbg)
==367==    by 0x7E09E3: CGameView::~CGameView() (GameView.cpp:377)
==367==    by 0x7E0A6A: CGameView::~CGameView() (GameView.cpp:378)
==367==    by 0x734769: CGame::~CGame() (Game.cpp:100)
==367==    by 0x7622E4: EndGame() (GameSetup.cpp:679)
==367==    by 0x762346: Shutdown(int) (GameSetup.cpp:690)
==367==    by 0x4B4EC3: RunGameOrAtlas(int, char const**) (main.cpp:512)
==367== 
==367== Use of uninitialised value of size 8
==367==    at 0x3BF46296: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x3BF45C2F: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x3BF95368: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x7C8C2B: CLOSTexture::DeleteTexture() (LOSTexture.cpp:97)
==367==    by 0x7C8A0C: CLOSTexture::~CLOSTexture() (LOSTexture.cpp:70)
==367==    by 0x7E776B: CGameViewImpl::~CGameViewImpl() (in /home/usera/Coding/0ad/binaries/system/pyrogenesis_dbg)
==367==    by 0x7E09E3: CGameView::~CGameView() (GameView.cpp:377)
==367==    by 0x7E0A6A: CGameView::~CGameView() (GameView.cpp:378)
==367==    by 0x734769: CGame::~CGame() (Game.cpp:100)
==367==    by 0x7622E4: EndGame() (GameSetup.cpp:679)
==367==    by 0x762346: Shutdown(int) (GameSetup.cpp:690)
==367==    by 0x4B4EC3: RunGameOrAtlas(int, char const**) (main.cpp:512)
==367== 
==367== Conditional jump or move depends on uninitialised value(s)
==367==    at 0x3BF4629A: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x3BF45C2F: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x3BF95368: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x7C8C2B: CLOSTexture::DeleteTexture() (LOSTexture.cpp:97)
==367==    by 0x7C8A0C: CLOSTexture::~CLOSTexture() (LOSTexture.cpp:70)
==367==    by 0x7E776B: CGameViewImpl::~CGameViewImpl() (in /home/usera/Coding/0ad/binaries/system/pyrogenesis_dbg)
==367==    by 0x7E09E3: CGameView::~CGameView() (GameView.cpp:377)
==367==    by 0x7E0A6A: CGameView::~CGameView() (GameView.cpp:378)
==367==    by 0x734769: CGame::~CGame() (Game.cpp:100)
==367==    by 0x7622E4: EndGame() (GameSetup.cpp:679)
==367==    by 0x762346: Shutdown(int) (GameSetup.cpp:690)
==367==    by 0x4B4EC3: RunGameOrAtlas(int, char const**) (main.cpp:512)
==367== 
==367== Conditional jump or move depends on uninitialised value(s)
==367==    at 0x3BF462D0: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x3BF45C2F: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x3BF95368: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x7C8C2B: CLOSTexture::DeleteTexture() (LOSTexture.cpp:97)
==367==    by 0x7C8A0C: CLOSTexture::~CLOSTexture() (LOSTexture.cpp:70)
==367==    by 0x7E776B: CGameViewImpl::~CGameViewImpl() (in /home/usera/Coding/0ad/binaries/system/pyrogenesis_dbg)
==367==    by 0x7E09E3: CGameView::~CGameView() (GameView.cpp:377)
==367==    by 0x7E0A6A: CGameView::~CGameView() (GameView.cpp:378)
==367==    by 0x734769: CGame::~CGame() (Game.cpp:100)
==367==    by 0x7622E4: EndGame() (GameSetup.cpp:679)
==367==    by 0x762346: Shutdown(int) (GameSetup.cpp:690)
==367==    by 0x4B4EC3: RunGameOrAtlas(int, char const**) (main.cpp:512)
==367== 
==367== Conditional jump or move depends on uninitialised value(s)
==367==    at 0x3BF45C33: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x3BF95368: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x7C8C2B: CLOSTexture::DeleteTexture() (LOSTexture.cpp:97)
==367==    by 0x7C8A0C: CLOSTexture::~CLOSTexture() (LOSTexture.cpp:70)
==367==    by 0x7E776B: CGameViewImpl::~CGameViewImpl() (in /home/usera/Coding/0ad/binaries/system/pyrogenesis_dbg)
==367==    by 0x7E09E3: CGameView::~CGameView() (GameView.cpp:377)
==367==    by 0x7E0A6A: CGameView::~CGameView() (GameView.cpp:378)
==367==    by 0x734769: CGame::~CGame() (Game.cpp:100)
==367==    by 0x7622E4: EndGame() (GameSetup.cpp:679)
==367==    by 0x762346: Shutdown(int) (GameSetup.cpp:690)
==367==    by 0x4B4EC3: RunGameOrAtlas(int, char const**) (main.cpp:512)
==367==    by 0x4B51D5: main (main.cpp:555)
==367== 
==367== Use of uninitialised value of size 8
==367==    at 0x3BF45C35: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x3BF95368: ??? (in /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)
==367==    by 0x7C8C2B: CLOSTexture::DeleteTexture() (LOSTexture.cpp:97)
==367==    by 0x7C8A0C: CLOSTexture::~CLOSTexture() (LOSTexture.cpp:70)
==367==    by 0x7E776B: CGameViewImpl::~CGameViewImpl() (in /home/usera/Coding/0ad/binaries/system/pyrogenesis_dbg)
==367==    by 0x7E09E3: CGameView::~CGameView() (GameView.cpp:377)
==367==    by 0x7E0A6A: CGameView::~CGameView() (GameView.cpp:378)
==367==    by 0x734769: CGame::~CGame() (Game.cpp:100)
==367==    by 0x7622E4: EndGame() (GameSetup.cpp:679)
==367==    by 0x762346: Shutdown(int) (GameSetup.cpp:690)
==367==    by 0x4B4EC3: RunGameOrAtlas(int, char const**) (main.cpp:512)
==367==    by 0x4B51D5: main (main.cpp:555)
==367== 
==367== Conditional jump or move depends on uninitialised value(s)
==367==    at 0x7C8C35: CLOSTexture::DeleteTexture() (LOSTexture.cpp:99)
==367==    by 0x7C8A0C: CLOSTexture::~CLOSTexture() (LOSTexture.cpp:70)
==367==    by 0x7E776B: CGameViewImpl::~CGameViewImpl() (in /home/usera/Coding/0ad/binaries/system/pyrogenesis_dbg)
==367==    by 0x7E09E3: CGameView::~CGameView() (GameView.cpp:377)
==367==    by 0x7E0A6A: CGameView::~CGameView() (GameView.cpp:378)
==367==    by 0x734769: CGame::~CGame() (Game.cpp:100)
==367==    by 0x7622E4: EndGame() (GameSetup.cpp:679)
==367==    by 0x762346: Shutdown(int) (GameSetup.cpp:690)
==367==    by 0x4B4EC3: RunGameOrAtlas(int, char const**) (main.cpp:512)
==367==    by 0x4B51D5: main (main.cpp:555)
==367== 

System details:

$ uname -msr
Linux 3.13.0-37-generic x86_64
$ glxinfo | grep OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Ironlake Mobile 
OpenGL version string: 2.1 Mesa 10.1.3
OpenGL shading language version string: 1.20

The relevant variables are m_TextureSmooth1 and m_TextureSmooth2, which are used in an if branch then passed into the Mesa i965 driver via glDeleteTextures().

Attachments (1)

fix-2862-valgrind-CLOSTexture-dtor.patch (760 bytes ) - added by Echelon9 10 years ago.
Proposed patch

Download all attachments as: .zip

Change History (4)

by Echelon9, 10 years ago

Proposed patch

comment:1 by Echelon9, 10 years ago

Keywords: review patch added
Summary: Valgrind warnings on game shutdown[PATCH] Valgrind warnings on game shutdown

comment:2 by leper, 10 years ago

Owner: set to leper
Resolution: fixed
Status: newclosed

In 15851:

Initialize some variables. Patch by Echelon9. Fixes #2862.

comment:3 by leper, 10 years ago

Keywords: review removed

Thanks for the patch.

Note: See TracTickets for help on using tickets.