summaryrefslogtreecommitdiffstats
path: root/vmchooser/readLinSess.cxx
diff options
context:
space:
mode:
authorBastian Wissler2009-04-01 18:55:03 +0200
committerBastian Wissler2009-04-01 18:55:03 +0200
commit8c7b37828c921c361b92f5d0003a488e8b2fb3d1 (patch)
treeaac293d51c47c4b8a42ae14cbb95afb104b0c183 /vmchooser/readLinSess.cxx
parentnew version of vmchooser binary imported to 5.0-branch (diff)
downloadvmchooser-8c7b37828c921c361b92f5d0003a488e8b2fb3d1.tar.gz
vmchooser-8c7b37828c921c361b92f5d0003a488e8b2fb3d1.tar.xz
vmchooser-8c7b37828c921c361b92f5d0003a488e8b2fb3d1.zip
vmchooser source:
* Various fixes found by Valgrind * libxml2 lib included * fltk from weekly snapshot updated git-svn-id: http://svn.openslx.org/svn/openslx/openslx-src-tools/vmchooser/trunk@2777 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'vmchooser/readLinSess.cxx')
-rw-r--r--vmchooser/readLinSess.cxx16
1 files changed, 10 insertions, 6 deletions
diff --git a/vmchooser/readLinSess.cxx b/vmchooser/readLinSess.cxx
index 5591797..73dae0e 100644
--- a/vmchooser/readLinSess.cxx
+++ b/vmchooser/readLinSess.cxx
@@ -28,12 +28,12 @@ static int errorfunc(const char* errpath, int errno)
static glob_t* globber(char* path, const char* filetype)
{
glob_t* gResult = (glob_t*) malloc(sizeof(glob_t));
- char* temp = (char*) malloc(strlen(path)+strlen(filetype)-1);
+ char* temp = (char*) malloc(strlen(path)+strlen(filetype)+1);
strcpy(temp, path);
strcat(temp, filetype);
if (glob(temp, GLOB_NOSORT, &errorfunc, gResult)) {
- fprintf(stderr, "Fehler beim Öffnen des Ordners!\n");
+ fprintf(stderr, "Fehler beim Öffnen des Ordners!\n");
return NULL;
}
return gResult;
@@ -49,16 +49,20 @@ DataEntry** readLinSess(char* path)
char* val;
if ( path== NULL) {
- return NULL;
- }
- glob_t *gResult = globber(path, "*.desktop");
+ return NULL;
+ }
+
+ glob_t *gResult = (glob_t*) malloc(sizeof(glob_t));
+ gResult = globber(path, "*.desktop");
+
if ( gResult== NULL) {
return NULL;
}
if ( gResult->gl_pathc == 0 ) {
return NULL;
}
- DataEntry** result = (DataEntry**) malloc(gResult->gl_pathc * sizeof(DataEntry*) +1);
+ DataEntry** result =
+ (DataEntry**) malloc(gResult->gl_pathc *( sizeof(DataEntry*) +1));
int c = 0;