summaryrefslogtreecommitdiff
path: root/security/trousers/files/patch-src-tspi-rpc-hosttable.c
blob: 144ec14535ad475f0ef96921fadd95ef244aafe5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- src/tspi/rpc/hosttable.c.orig	2014-04-24 18:05:44 UTC
+++ src/tspi/rpc/hosttable.c
@@ -51,6 +51,8 @@ host_table_final()
 {
 	struct host_table_entry *hte, *next = NULL;
 
+	if( ht == NULL ) return;
+
 	MUTEX_LOCK(ht->lock);
 
 	for (hte = ht->entries; hte; hte = next) {
@@ -84,6 +86,8 @@ __tspi_add_table_entry(TSS_HCONTEXT tspC
 {
 	struct host_table_entry *entry, *tmp;
 
+	if( ht == NULL ) return TSPERR(TSS_E_OUTOFMEMORY);
+
         entry = calloc(1, sizeof(struct host_table_entry));
         if (entry == NULL) {
                 LogError("malloc of %zd bytes failed.", sizeof(struct host_table_entry));
@@ -134,6 +138,8 @@ remove_table_entry(TSS_HCONTEXT tspConte
 {
 	struct host_table_entry *hte, *prev = NULL;
 
+	if( ht == NULL ) return;
+
 	MUTEX_LOCK(ht->lock);
 
 	for (hte = ht->entries; hte; prev = hte, hte = hte->next) {
@@ -158,6 +164,8 @@ get_table_entry(TSS_HCONTEXT tspContext)
 {
 	struct host_table_entry *index = NULL;
 
+	if( ht == NULL ) return NULL;
+
 	MUTEX_LOCK(ht->lock);
 
 	for (index = ht->entries; index; index = index->next) {