Skip to content

Commit c8fd72a

Browse files
authoredOct 6, 2021
Merge pull request #27 from CyberSource/future
Sync Future To Master
2 parents e972d71 + 57dbf0b commit c8fd72a

File tree

5,116 files changed

+1397226
-902201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,116 files changed

+1397226
-902201
lines changed
 

‎BaseClient/BaseClient.vcxproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,32 @@
2222
<ProjectGuid>{E5D6E166-C770-4B63-9501-4274E29D56E2}</ProjectGuid>
2323
<Keyword>Win32Proj</Keyword>
2424
<RootNamespace>BaseClient</RootNamespace>
25-
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
25+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
2626
</PropertyGroup>
2727
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2828
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
2929
<ConfigurationType>DynamicLibrary</ConfigurationType>
3030
<UseDebugLibraries>true</UseDebugLibraries>
31-
<PlatformToolset>v141</PlatformToolset>
31+
<PlatformToolset>v142</PlatformToolset>
3232
<CharacterSet>Unicode</CharacterSet>
3333
</PropertyGroup>
3434
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
3535
<ConfigurationType>DynamicLibrary</ConfigurationType>
3636
<UseDebugLibraries>true</UseDebugLibraries>
37-
<PlatformToolset>v141</PlatformToolset>
37+
<PlatformToolset>v142</PlatformToolset>
3838
<CharacterSet>Unicode</CharacterSet>
3939
</PropertyGroup>
4040
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
4141
<ConfigurationType>DynamicLibrary</ConfigurationType>
4242
<UseDebugLibraries>false</UseDebugLibraries>
43-
<PlatformToolset>v141</PlatformToolset>
43+
<PlatformToolset>v142</PlatformToolset>
4444
<WholeProgramOptimization>true</WholeProgramOptimization>
4545
<CharacterSet>Unicode</CharacterSet>
4646
</PropertyGroup>
4747
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
4848
<ConfigurationType>DynamicLibrary</ConfigurationType>
4949
<UseDebugLibraries>false</UseDebugLibraries>
50-
<PlatformToolset>v141</PlatformToolset>
50+
<PlatformToolset>v142</PlatformToolset>
5151
<WholeProgramOptimization>true</WholeProgramOptimization>
5252
<CharacterSet>Unicode</CharacterSet>
5353
</PropertyGroup>

‎BaseClient/kvs.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ static void resize_pairs(CybsMap *store) {
5353
store->pairs = (CybsTable*)realloc(store->pairs, kvs_pair_size * store->length);
5454
}
5555

56+
static void mem_alloc_error()
57+
{
58+
fprintf(stderr, "Failed to allocate memory");
59+
}
60+
5661
static void create_pair(CybsMap *store, const void *key, void *value) {
5762
CybsTable *pair;
5863
if (!store) {
@@ -70,6 +75,10 @@ static void create_pair(CybsMap *store, const void *key, void *value) {
7075
//pair->key = key;
7176
//pair->value = value;
7277
pair->value = (char *) malloc(valueCopy.size() + sizeof(char));
78+
if(!pair->value) {
79+
mem_alloc_error();
80+
exit(0);
81+
}
7382
valueCopy.copy((char *)pair->value, valueCopy.size(), 0);
7483
((char *) pair->value)[valueCopy.size()]='\0';
7584
sort_pairs(store);
@@ -88,7 +97,11 @@ static void remove_pair(CybsMap *store, CybsTable *pair) {
8897
}
8998

9099
CybsMap *cybs_create_map(void) {
91-
CybsMap *store = (CybsMap *)malloc(kvs_store_size);
100+
CybsMap *store = (CybsMap *)malloc(kvs_store_size);
101+
if(!store) {
102+
mem_alloc_error();
103+
exit(0);
104+
}
92105
store->pairs = NULL;
93106
store->length = 0;
94107
store->totallength = 0;
@@ -137,6 +150,10 @@ void cybs_add(CybsMap *store, const void *key, void *value) {
137150
free (pair->value);
138151
string valueCopy((char *)value);
139152
pair->value = (char *) malloc(valueCopy.size() + sizeof(char));
153+
if(!pair->value) {
154+
mem_alloc_error();
155+
exit(0);
156+
}
140157
valueCopy.copy((char *) pair->value, valueCopy.size(), 0);
141158
((char *) pair->value)[valueCopy.size()]='\0';
142159
} else {
@@ -152,6 +169,7 @@ void cybs_add(CybsMap *store, const void *key, void *value) {
152169
}
153170

154171
void *cybs_get(CybsMap *store, const void *key) {
155-
CybsTable *pair = get_pair(store, key);
172+
CybsTable *pair = get_pair(store, key);
156173
return pair ? pair->value : NULL;
157-
}
174+
}
175+

0 commit comments

Comments
 (0)