Skip to content

Commit

Permalink
bugfix in tixiRenameElement
Browse files Browse the repository at this point in the history
  • Loading branch information
joergbrech committed Jun 29, 2018
1 parent bbee05a commit 6f60e62
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tixiImpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1657,6 +1657,7 @@ DLL_EXPORT ReturnCode tixiRenameElement(const TixiDocumentHandle handle,
const char* oldName,
const char* newName)
{
char* elementPath = (char*) malloc( sizeof(char) *( strlen(parentPath) + strlen(oldName) + 2 ) );
xmlNodePtr parent = NULL;
xmlNodePtr element = NULL;
int retVal = 0;
Expand All @@ -1670,12 +1671,12 @@ DLL_EXPORT ReturnCode tixiRenameElement(const TixiDocumentHandle handle,
return INVALID_XPATH;
}

char* elementPath = (char*) malloc( sizeof(char) *( strlen(parentPath) + strlen(oldName) + 2 ) );
elementPath[0] = '\0';
strcat(elementPath, parentPath);
strcat(elementPath, "/");
strcat(elementPath, oldName);
retVal = getNodePtrFromElementPath(handle, elementPath, &element);
free(elementPath);
if (retVal != SUCCESS) {
return retVal;
}
Expand Down

0 comments on commit 6f60e62

Please sign in to comment.