if (global_free == 1) return;
- free(global_s.s_name);
+ if (global_s.s_name != NULL) free(global_s.s_name);
+ global_s.s_name = NULL;
+
+ if (global_s.s_proto != NULL) free(global_s.s_proto);
+ global_s.s_proto = NULL;
aliases = global_s.s_aliases;
if (aliases != NULL)
{
while (*aliases != NULL) free(*aliases++);
free(global_s.s_aliases);
+ global_s.s_aliases = NULL;
}
global_free = 1;
global_s.s_aliases[len] = NULL;
- global_s.s_proto = lu_s->s_proto;
+ if (lu_s->s_proto != NULL) global_s.s_proto = strdup(lu_s->s_proto);
global_s.s_port = lu_s->s_port;
global_free = 0;