1 --- src/tspi/rpc/hosttable.c.orig 2016-11-19 03:09:49 UTC 2 +++ src/tspi/rpc/hosttable.c 3 @@ -51,6 +51,8 @@ host_table_final() 4 { 5 struct host_table_entry *hte, *next = NULL; 6 7 + if( ht == NULL ) return; 8 + 9 MUTEX_LOCK(ht->lock); 10 11 for (hte = ht->entries; hte; hte = next) { 12 @@ -85,6 +87,8 @@ __tspi_add_table_entry(TSS_HCONTEXT tspC 13 struct host_table_entry *entry, *tmp; 14 int hostlen; 15 16 + if( ht == NULL ) return TSPERR(TSS_E_OUTOFMEMORY); 17 + 18 entry = calloc(1, sizeof(struct host_table_entry)); 19 if (entry == NULL) { 20 LogError("malloc of %zd bytes failed.", sizeof(struct host_table_entry)); 21 @@ -144,6 +148,8 @@ remove_table_entry(TSS_HCONTEXT tspConte 22 { 23 struct host_table_entry *hte, *prev = NULL; 24 25 + if( ht == NULL ) return; 26 + 27 MUTEX_LOCK(ht->lock); 28 29 for (hte = ht->entries; hte; prev = hte, hte = hte->next) { 30 @@ -168,6 +174,8 @@ get_table_entry(TSS_HCONTEXT tspContext) 31 { 32 struct host_table_entry *index = NULL; 33 34 + if( ht == NULL ) return NULL; 35 + 36 MUTEX_LOCK(ht->lock); 37 38 for (index = ht->entries; index; index = index->next) { 39