Commit 60a0e3d0 authored by unknown's avatar unknown
Browse files

BUG#21670 memory leak in ndb_mgm -e show

fix the following valgrind warning when running ndb_mgm -e show (leak only in client)

==20398== 14,596 (11,936 direct, 2,660 indirect) bytes in 4 blocks are definitely lost in loss record 24 of 25
==20398==    at 0x401C4A1: malloc (vg_replace_malloc.c:149)
==20398==    by 0x80797A3: ConfigValuesFactory::create(unsigned, unsigned) (ConfigValues.cpp:309)
==20398==    by 0x8079F03: ConfigValuesFactory::expand(unsigned, unsigned) (ConfigValues.cpp:325)
==20398==    by 0x8079967: ConfigValuesFactory::put(ConfigValues::Entry const&) (ConfigValues.cpp:414)
==20398==    by 0x807A7B6: ConfigValuesFactory::unpack(void const*, unsigned) (ConfigValues.cpp:701)
==20398==    by 0x806CB9D: ConfigValuesFactory::unpack(UtilBuffer const&) (ConfigValues.hpp:252)
==20398==    by 0x8069160: ndb_mgm_get_configuration (mgmapi.cpp:1941)
==20398==    by 0x8060661: CommandInterpreter::executeShow(char*) (CommandInterpreter.cpp:1242)
==20398==    by 0x8063966: CommandInterpreter::execute_impl(char const*) (CommandInterpreter.cpp:715)
==20398==    by 0x8064040: CommandInterpreter::execute(char const*, int, int*) (CommandInterpreter.cpp:625)
==20398==    by 0x8064189: Ndb_mgmclient::execute(char const*, int, int*) (CommandInterpreter.cpp:203)
==20398==    by 0x805E56C: read_and_execute(int) (main.cpp:124)
==20398==    by 0x805E754: main (main.cpp:162)
==20398==


ndb/src/mgmclient/CommandInterpreter.cpp:
  correctly free (destroy) the configuration fetched for show
parent f32014a9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1245,6 +1245,7 @@ CommandInterpreter::executeShow(char* parameters)

    if(it == 0){
      ndbout_c("Unable to create config iterator");
      ndb_mgm_destroy_configuration(conf);
      return;
    }
    NdbAutoPtr<ndb_mgm_configuration_iterator> ptr(it);
@@ -1291,6 +1292,7 @@ CommandInterpreter::executeShow(char* parameters)
    print_nodes(state, it, "ndb_mgmd", mgm_nodes, NDB_MGM_NODE_TYPE_MGM, 0);
    print_nodes(state, it, "mysqld",   api_nodes, NDB_MGM_NODE_TYPE_API, 0);
    //    ndbout << helpTextShow;
    ndb_mgm_destroy_configuration(conf);
    return;
  } else if (strcasecmp(parameters, "PROPERTIES") == 0 ||
	     strcasecmp(parameters, "PROP") == 0) {