From 6fc6a76bb7dafa624859d06e93d8c49d3b099af4 Mon Sep 17 00:00:00 2001 From: Bastian Wissler Date: Wed, 14 Jan 2009 11:41:55 +0000 Subject: vmchooser: * Fixed bug in binary: Memory gets freed to early git-svn-id: http://svn.openslx.org/svn/openslx/openslx-src-tools/vmchooser/trunk@2479 95ad53e4-c205-0410-b2fa-d234c58c8868 --- vmchooser/Makefile | 2 +- vmchooser/addInfo.cxx | 30 ++++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/vmchooser/Makefile b/vmchooser/Makefile index 6bc1390..5e32081 100644 --- a/vmchooser/Makefile +++ b/vmchooser/Makefile @@ -8,7 +8,7 @@ CC = g++ DEBUG_CCFLAGS = -O0 -Wall -I/usr/include -I../fltk-2/include/ -I. `xml2-config --cflags` -ggdb #-ggdb #-Werror CCFLAGS = -O2 -Wall -I/usr/include -I../fltk-2/include/ -I. `xml2-config --cflags` LDFLAGS = -L../fltk-2/lib/ -L/usr/lib -LIBS = -lpng ../fltk-2/lib/libfltk2_images.a -ljpeg -lz -lXi -lXinerama -lpthread -lm -lXext -lsupc++ -lXrender -lfontconfig -lxml2 -lXft -lXdmcp -lXau -ldl -lz -lfreetype -lX11 ../fltk-2/lib/libfltk2.a /usr/lib/libboost_regex.a +LIBS = -lpng ../fltk-2/lib/libfltk2_images.a -ljpeg -lz -lXi -lXinerama -lpthread -lm -lXext -lsupc++ -lXrender -lfontconfig -lxml2 -lXft -lXdmcp -lXau -ldl -lz -lfreetype -lX11 ../fltk-2/lib/libfltk2.a /usr/lib/libboost_regex-s.a .PHONY: all clean distclean all:: ${TARGET} diff --git a/vmchooser/addInfo.cxx b/vmchooser/addInfo.cxx index 1076a36..144e061 100644 --- a/vmchooser/addInfo.cxx +++ b/vmchooser/addInfo.cxx @@ -82,25 +82,27 @@ void addInfo(xmlNode* node) { else { cerr << " node could not be created!" << endl; } - compnamenode = xmlNewNode(NULL, (const xmlChar*) "computername"); - if(compnamenode != NULL) { - xmlNewProp(compnamenode, (const xmlChar*) "param", (const xmlChar*) hostname); - // Add this node to the beginning of available children - // -> that is because bootpgm only looks in the first 500 chars - if(firstchild != NULL) { - xmlAddPrevSibling(firstchild, compnamenode); - } - xmlFreeNode(compnamenode); - } - else { - cerr << " node could not be created!" << endl; - } } else { // add param value to existant hostname-node xmlSetProp(hostnamenode, (const xmlChar*) "param", (xmlChar*) hostname); } - + + // We need to add computername-node as the first node + compnamenode = xmlNewNode(NULL, (const xmlChar*) "computername"); + if(compnamenode != NULL) { + xmlNewProp(compnamenode, (const xmlChar*) "param", (const xmlChar*) hostname); + // Add this node to the beginning of available children + // -> that is because bootpgm only looks in the first 500 chars + if(firstchild != NULL) { + xmlAddPrevSibling(firstchild, compnamenode); + } + //xmlFreeNode(compnamenode); + } + else { + cerr << " node could not be created!" << endl; + } + return; } -- cgit v1.2.3-55-g7522