Index: src/tspi/rpc/hosttable.c |
diff --git a/src/tspi/rpc/hosttable.c b/src/tspi/rpc/hosttable.c |
index 99bb276471783277976220e43465bc3cd2c484f9..f3ec2eb97e8fa6080f626fa1f59954f1d50acbf7 100644 |
--- a/src/tspi/rpc/hosttable.c |
+++ b/src/tspi/rpc/hosttable.c |
@@ -35,13 +35,17 @@ host_table_init() |
return TSS_SUCCESS; |
} |
+#ifdef SOLARIS |
+#pragma init(_init) |
+void _init(void) |
+#else |
void __attribute__ ((constructor)) my_init(void) |
+#endif |
{ |
host_table_init(); |
__tspi_obj_list_init(); |
} |
-#if 0 |
void |
host_table_final() |
{ |
@@ -52,6 +56,10 @@ host_table_final() |
for (hte = ht->entries; hte; hte = next) { |
if (hte) |
next = hte->next; |
+ if (hte->hostname) |
+ free(hte->hostname); |
+ if (hte->comm.buf) |
+ free(hte->comm.buf); |
free(hte); |
} |
@@ -61,11 +69,15 @@ host_table_final() |
ht = NULL; |
} |
+#ifdef SOLARIS |
+#pragma fini(_fini) |
+void _fini(void) |
+#else |
void __attribute__ ((destructor)) my_fini(void) |
+#endif |
{ |
host_table_final(); |
} |
-#endif |
TSS_RESULT |
__tspi_add_table_entry(TSS_HCONTEXT tspContext, BYTE *host, int type, struct host_table_entry **ret) |
@@ -96,6 +108,7 @@ __tspi_add_table_entry(TSS_HCONTEXT tspContext, BYTE *host, int type, struct hos |
if (tmp->tspContext == tspContext) { |
LogError("Tspi_Context_Connect attempted on an already connected context!"); |
MUTEX_UNLOCK(ht->lock); |
+ free(entry->hostname); |
free(entry->comm.buf); |
free(entry); |
return TSPERR(TSS_E_CONNECTION_FAILED); |
@@ -129,6 +142,8 @@ remove_table_entry(TSS_HCONTEXT tspContext) |
prev->next = hte->next; |
else |
ht->entries = hte->next; |
+ if (hte->hostname) |
+ free(hte->hostname); |
free(hte->comm.buf); |
free(hte); |
break; |