/*
- * Copyright (c) 2012, JANET(UK)
+ * Copyright (c) 2012-2018, JANET(UK)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include <tr_rp.h>
#include <tr_idp.h>
-#include <trust_router/tr_name.h>
+#include <tr_name_internal.h>
#include <tr_comm.h>
#include <tr_debug.h>
return NULL;
/* will not remove the head here, that has already been done */
- for (comm=head; comm->next!=NULL; comm=comm->next) {
+ for (comm=head; (comm!=NULL) && (comm->next!=NULL); comm=comm->next) {
if (comm->next->refcount==0) {
old_next=comm->next;
- tr_comm_remove(head, comm->next); /* changes comm->next */
+ tr_comm_remove(head, comm->next); /* changes comm->next, may make it null */
tr_comm_free(old_next);
}
}
void tr_comm_table_print(FILE *f, TR_COMM_TABLE *ctab)
{
char *s=tr_comm_table_to_str(NULL, ctab);
- if (s!=NULL)
- fprintf(f, "%s", s);
- talloc_free(s);
+ if (s!=NULL) {
+ tr_debug("%s", s);
+ talloc_free(s);
+ }
}
\ No newline at end of file