Fix various memory access problems detected by valgrind
authorKahrl <kahrl@gmx.net>
Wed, 7 Aug 2013 17:48:31 +0000 (19:48 +0200)
committerKahrl <kahrl@gmx.net>
Wed, 7 Aug 2013 17:48:31 +0000 (19:48 +0200)
src/content_sao.cpp
src/filesys.cpp
src/guiFormSpecMenu.cpp
src/player.cpp

index 799c279a4969bea6833ee986d6535561cff185db..ed660cf1006139cbc21379083669d3df095adf87 100644 (file)
@@ -943,8 +943,11 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
        m_properties_sent(true),
        m_privs(privs),
        m_is_singleplayer(is_singleplayer),
+       m_animation_speed(0),
+       m_animation_blend(0),
        m_animation_sent(false),
        m_bone_position_sent(false),
+       m_attachment_parent_id(0),
        m_attachment_sent(false),
        // public
        m_moved(false),
index 21ff199a874c804a03a04c27ef75b2b9cc2b2024..356d3018deff2843816f19a87e486479240efa85 100644 (file)
@@ -595,7 +595,7 @@ bool PathStartsWith(std::string path, std::string prefix)
                                        && !IsDirDelimiter(path[pathpos+len])
                                        && prefixpos+len < prefixsize
                                        && !IsDirDelimiter(
-                                               prefix[prefixsize+len]));
+                                               prefix[prefixpos+len]));
                        pathpos += len;
                        prefixpos += len;
                }
index 45b0fe2e0fde2ea4d4f20ec69974b962e0b7f596..0f09eaf5205844c7c5dc425c3f0ef87fb0f1d1c3 100644 (file)
@@ -174,6 +174,7 @@ GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev,
        current_keys_pending.key_down = false;
        current_keys_pending.key_up = false;
        current_keys_pending.key_enter = false;
+       current_keys_pending.key_escape = false;
 
 }
 
index 8028fe6afb57d5cb7e750bb04d268b554fea2e31..193de55a90f55ba9f723fba32b03600b28cf49a1 100644 (file)
@@ -34,9 +34,13 @@ Player::Player(IGameDef *gamedef):
        is_climbing(false),
        swimming_vertical(false),
        camera_barely_in_ceiling(false),
+       light(0),
        inventory(gamedef->idef()),
        hp(PLAYER_MAX_HP),
+       hurt_tilt_timer(0),
+       hurt_tilt_strength(0),
        peer_id(PEER_ID_INEXISTENT),
+       keyPressed(0),
 // protected
        m_gamedef(gamedef),
        m_breath(-1),