From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
--- dlls/odbccp32/odbccp32.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/dlls/odbccp32/odbccp32.c b/dlls/odbccp32/odbccp32.c index 90875121438..62e35e85f75 100644 --- a/dlls/odbccp32/odbccp32.c +++ b/dlls/odbccp32/odbccp32.c @@ -997,16 +997,28 @@ static void write_registry_values(const WCHAR *regkey, const WCHAR *driver, cons if(lstrcmpiW(driverW, entry) == 0 || lstrcmpiW(setupW, entry) == 0 || lstrcmpiW(translator, entry) == 0) { - len = lstrlenW(path) + lstrlenW(slash) + lstrlenW(divider) + 1; - value = malloc(len * sizeof(WCHAR)); - if(!value) + if(GetFileAttributesW(divider) == INVALID_FILE_ATTRIBUTES) { - ERR("Out of memory\n"); - return; + len = lstrlenW(path) + lstrlenW(slash) + lstrlenW(divider) + 1; + value = malloc(len * sizeof(WCHAR)); + if(!value) + { + ERR("Out of memory\n"); + return; + } + + lstrcpyW(value, path); + lstrcatW(value, slash); + } + else + { + value = calloc(1, (lstrlenW(divider)+1) * sizeof(WCHAR)); + if(!value) + { + ERR("Out of memory\n"); + return; + } } - - lstrcpyW(value, path); - lstrcatW(value, slash); lstrcatW(value, divider); } else