diff --git a/src/dedupe.c b/src/dedupe.c index 0f106183..3da34abd 100644 --- a/src/dedupe.c +++ b/src/dedupe.c @@ -164,9 +164,12 @@ ClearDedupeTable(void) void InitDedupeTable(void) { - hash_table_init(&DedupeTable, - offsetof(DedupeEntry, link), - DedupeHashFunc, CompareDedupes); + if (hash_table_init(&DedupeTable, + offsetof(DedupeEntry, link), + DedupeHashFunc, CompareDedupes) < 0) { + fprintf(stderr, "Unable to initialize function hash table: Out of memory. Exiting.\n"); + exit(1); + } } void diff --git a/src/trans.c b/src/trans.c index acac4ead..5ada42c8 100644 --- a/src/trans.c +++ b/src/trans.c @@ -168,8 +168,11 @@ CompareXlateItems(void *a, void *b) void InitTranslationTable(void) { - hash_table_init(&TranslationTable, offsetof(XlateItem, link), - HashXlateItem, CompareXlateItems); + if (hash_table_init(&TranslationTable, offsetof(XlateItem, link), + HashXlateItem, CompareXlateItems) < 0) { + fprintf(stderr, "Unable to initialize translation hash table: Out of memory. Exiting.\n"); + exit(1); + } } static XlateItem * diff --git a/src/userfns.c b/src/userfns.c index d5795fec..5654f3a4 100644 --- a/src/userfns.c +++ b/src/userfns.c @@ -53,10 +53,13 @@ static int CompareUserFuncs(void *a, void *b) void InitUserFunctions(void) { - hash_table_init(&FuncHash, - offsetof(UserFunc, link), - HashUserFunc, - CompareUserFuncs); + if (hash_table_init(&FuncHash, + offsetof(UserFunc, link), + HashUserFunc, + CompareUserFuncs) < 0) { + fprintf(stderr, "Unable to initialize function hash table: Out of memory. Exiting.\n"); + exit(1); + } } /***************************************************************/ diff --git a/src/var.c b/src/var.c index e0d21312..2569f6e6 100644 --- a/src/var.c +++ b/src/var.c @@ -53,8 +53,11 @@ static int VarCompareFunc(void *a, void *b) void InitVars(void) { - hash_table_init(&VHashTbl, offsetof(Var, link), - VarHashFunc, VarCompareFunc); + if (hash_table_init(&VHashTbl, offsetof(Var, link), + VarHashFunc, VarCompareFunc) < 0) { + fprintf(stderr, "Unable to initialize variable hash table: Out of memory. Exiting.\n"); + exit(1); + } } static double