msi: Correctly handle return value of msi_realloc.

This commit is contained in:
Lionel Debroux 2007-12-30 19:01:09 +01:00 committed by Alexandre Julliard
parent 66dc01be56
commit 99ad76c3c1
2 changed files with 21 additions and 9 deletions

View File

@ -4482,7 +4482,7 @@ static UINT ACTION_InstallServices( MSIPACKAGE *package )
/* converts arg1[~]arg2[~]arg3 to a list of ptrs to the strings */
static LPCWSTR *msi_service_args_to_vector(LPWSTR args, DWORD *numargs)
{
LPCWSTR *vector;
LPCWSTR *vector, *temp_vector;
LPWSTR p, q;
DWORD sep_len;
@ -4508,9 +4508,13 @@ static LPCWSTR *msi_service_args_to_vector(LPWSTR args, DWORD *numargs)
{
*q = '\0';
vector = msi_realloc(vector, (*numargs + 1) * sizeof(LPWSTR));
if (!vector)
temp_vector = msi_realloc(vector, (*numargs + 1) * sizeof(LPWSTR));
if (!temp_vector)
{
msi_free(vector);
return NULL;
}
vector = temp_vector;
p = q + sep_len;
}

View File

@ -353,7 +353,7 @@ static LPWSTR msi_build_createsql_prelude(LPWSTR table)
static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, DWORD num_columns)
{
LPWSTR columns;
LPWSTR columns, p;
LPCWSTR type;
DWORD sql_size = 1, i, len;
WCHAR expanded[128], *ptr;
@ -413,9 +413,13 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D
sprintfW(expanded, column_fmt, columns_data[i], type, size, extra, comma);
sql_size += lstrlenW(expanded);
columns = msi_realloc(columns, sql_size * sizeof(WCHAR));
if (!columns)
p = msi_realloc(columns, sql_size * sizeof(WCHAR));
if (!p)
{
msi_free(columns);
return NULL;
}
columns = p;
lstrcatW(columns, expanded);
}
@ -519,7 +523,7 @@ static LPWSTR msi_build_insertsql_prelude(LPWSTR table)
static LPWSTR msi_build_insertsql_columns(LPWSTR *columns_data, LPWSTR *types, DWORD num_columns)
{
LPWSTR columns;
LPWSTR columns, p;
DWORD sql_size = 1, i;
WCHAR expanded[128];
@ -540,9 +544,13 @@ static LPWSTR msi_build_insertsql_columns(LPWSTR *columns_data, LPWSTR *types, D
expanded[lstrlenW(expanded) - 2] = '\0';
}
columns = msi_realloc(columns, sql_size * sizeof(WCHAR));
if (!columns)
p = msi_realloc(columns, sql_size * sizeof(WCHAR));
if (!p)
{
msi_free(columns);
return NULL;
}
columns = p;
lstrcatW(columns, expanded);
}