commit c27ecfe196af587c59c748035d2a704fff59af4d
parent 68ae975237b615832301a9971aed67e1cf131bc2
Author: Heiko Wundram <modelnine@ceosg.de>
Date: Sat, 7 May 2005 19:25:04 +0000
Options set to be NULL when no () specified in string passed to
loadConfigLibraries() in extractor.c.
Diffstat:
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/main/extractor.c b/src/main/extractor.c
@@ -398,7 +398,10 @@ EXTRACTOR_addLibrary2 (EXTRACTOR_ExtractorList * prev,
result->libraryHandle = handle;
result->extractMethod = method;
result->libname = strdup (library);
- result->options = strdup (options);
+ if( options )
+ result->options = strdup (options);
+ else
+ result->options = NULL;
return result;
}
@@ -432,7 +435,10 @@ EXTRACTOR_addLibraryLast2 (EXTRACTOR_ExtractorList * prev,
result->libraryHandle = handle;
result->extractMethod = method;
result->libname = strdup (library);
- result->options = strdup (options);
+ if( options )
+ result->options = strdup (options);
+ else
+ result->options = NULL;
if (prev == NULL)
return result;
pos = prev;
@@ -506,16 +512,23 @@ EXTRACTOR_loadConfigLibraries (EXTRACTOR_ExtractorList * prev,
cpy[pos++] = '\0'; /* end of string. */
}
} else {
- lastconf = pos; /* start config from here = "". */
+ lastconf = -1; /* NULL config when no (). */
cpy[pos++] = '\0'; /* replace ':' by termination */
}
if (cpy[last] == '-')
{
last++;
- prev = EXTRACTOR_addLibraryLast2 (prev, &cpy[last], &cpy[lastconf]);
+ if( lastconf != -1 )
+ prev = EXTRACTOR_addLibraryLast2 (prev, &cpy[last],
+ &cpy[lastconf]);
+ else
+ prev = EXTRACTOR_addLibraryLast2 (prev, &cpy[last], NULL);
}
else
- prev = EXTRACTOR_addLibrary2 (prev, &cpy[last], &cpy[lastconf]);
+ if( lastconf != -1 )
+ prev = EXTRACTOR_addLibrary2 (prev, &cpy[last], &cpy[lastconf]);
+ else
+ prev = EXTRACTOR_addLibrary2 (prev, &cpy[last], NULL);
last = pos;
}
@@ -551,7 +564,8 @@ EXTRACTOR_removeLibrary(EXTRACTOR_ExtractorList * prev,
prev->next = pos->next;
/* found */
free (pos->libname);
- free (pos->options);
+ if( pos->options )
+ free (pos->options);
if( pos->libraryHandle )
lt_dlclose (pos->libraryHandle);
free (pos);