From 79c4472eee931c9f6fe46f48fca93f503e0fa09a Mon Sep 17 00:00:00 2001 From: florent <florent@laas.fr> Date: Fri, 22 Oct 2010 21:37:35 +0200 Subject: [PATCH] Fix a memory bug * src/entity-py.cc: change std::string in char*. --- src/entity-py.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/entity-py.cc b/src/entity-py.cc index c77c0d9..aa977d5 100644 --- a/src/entity-py.cc +++ b/src/entity-py.cc @@ -183,7 +183,7 @@ namespace dynamicgraph { { PyObject* object = NULL; PyObject* argTuple = NULL; - std::string commandName; + char* commandName = NULL; void* pointer = NULL; if (!PyArg_ParseTuple(args, "OsO", &object, &commandName, &argTuple)) { @@ -208,13 +208,13 @@ namespace dynamicgraph { std::map<const std::string, Command*> commandMap = entity->getNewStyleCommandMap(); - if (commandMap.count(commandName) != 1) { - std::string msg = "command " + commandName + + if (commandMap.count(std::string(commandName)) != 1) { + std::string msg = "command " + std::string(commandName) + " is not referenced in Entity " + entity->getName(); PyErr_SetString(error, msg.c_str()); return NULL; } - Command* command = commandMap[commandName]; + Command* command = commandMap[std::string(commandName)]; // Check that tuple size is equal to command number of arguments const std::vector<Value::Type> typeVector = command->valueTypes(); if (size != typeVector.size()) { -- GitLab