BRepositoryInfo::SetTo(): driver settings unloaded too early

The string pointers retrieved from the driver settings are only valid until
the settings handle is freed. The were also used afterwards, though.
This commit is contained in:
Ingo Weinhold
2013-03-29 20:09:20 +00:00
parent 9992342427
commit 10efbe6c5e
+3 -2
View File
@@ -17,6 +17,7 @@
#include <File.h>
#include <Message.h>
#include <AutoDeleter.h>
#include <package/PackageInfo.h>
@@ -182,6 +183,8 @@ BRepositoryInfo::SetTo(const BEntry& entry)
void* settingsHandle = parse_driver_settings_string(configString.String());
if (settingsHandle == NULL)
return B_BAD_DATA;
CObjectDeleter<void, status_t> settingsHandleDeleter(settingsHandle,
&unload_driver_settings);
const char* name = get_driver_parameter(settingsHandle, "name", NULL, NULL);
const char* url = get_driver_parameter(settingsHandle, "url", NULL, NULL);
@@ -194,8 +197,6 @@ BRepositoryInfo::SetTo(const BEntry& entry)
const char* architectureString
= get_driver_parameter(settingsHandle, "architecture", NULL, NULL);
unload_driver_settings(settingsHandle);
if (name == NULL || *name == '\0' || url == NULL || *url == '\0'
|| vendor == NULL || *vendor == '\0'
|| summary == NULL || *summary == '\0'