"Fossies" - the Fresh Open Source Software Archive

Member "monit-5.28.0/src/gc.c" (28 Mar 2021, 20709 Bytes) of package /linux/privat/monit-5.28.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "gc.c" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 5.27.2_vs_5.28.0.

    1 /*
    2  * Copyright (C) Tildeslash Ltd. All rights reserved.
    3  *
    4  * This program is free software: you can redistribute it and/or modify
    5  * it under the terms of the GNU Affero General Public License version 3.
    6  *
    7  * This program is distributed in the hope that it will be useful,
    8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   10  * GNU General Public License for more details.
   11  *
   12  * You should have received a copy of the GNU Affero General Public License
   13  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
   14  *
   15  * In addition, as a special exception, the copyright holders give
   16  * permission to link the code of portions of this program with the
   17  * OpenSSL library under certain conditions as described in each
   18  * individual source file, and distribute linked combinations
   19  * including the two.
   20  *
   21  * You must obey the GNU Affero General Public License in all respects
   22  * for all of the code used other than OpenSSL.
   23  */
   24 
   25 #include "config.h"
   26 
   27 #ifdef HAVE_STDIO_H
   28 #include <stdio.h>
   29 #endif
   30 
   31 #ifdef HAVE_STDLIB_H
   32 #include <stdlib.h>
   33 #endif
   34 
   35 // libmonit
   36 #include "util/List.h"
   37 
   38 #include "monit.h"
   39 #include "protocol.h"
   40 #include "ProcessTree.h"
   41 #include "engine.h"
   42 
   43 
   44 /* Private prototypes */
   45 static void _gc_service_list(Service_T *);
   46 static void _gc_service(Service_T *);
   47 static void _gc_servicegroup(ServiceGroup_T *);
   48 static void _gc_mail_server(MailServer_T *);
   49 static void _gcportlist(Port_T *);
   50 static void _gcfilesystem(FileSystem_T *);
   51 static void _gcicmp(Icmp_T *);
   52 static void _gcpql(Resource_T *);
   53 static void _gcptl(Timestamp_T *);
   54 static void _gcuptimelist(Uptime_T *);
   55 static void _gcparl(ActionRate_T *);
   56 static void _gc_action(Action_T *);
   57 static void _gc_eventaction(EventAction_T *);
   58 static void _gcpdl(Dependant_T *);
   59 static void _gcso(Size_T *);
   60 static void _gclinkstatus(LinkStatus_T *);
   61 static void _gclinkspeed(LinkSpeed_T *);
   62 static void _gclinksaturation(LinkSaturation_T *);
   63 static void _gcbandwidth(Bandwidth_T *);
   64 static void _gcmatch(Match_T *);
   65 static void _gcchecksum(Checksum_T *);
   66 static void _gcperm(Perm_T *);
   67 static void _gcstatus(Status_T *);
   68 static void _gcuid(Uid_T *);
   69 static void _gcgid(Gid_T *);
   70 static void _gcpid(Pid_T *);
   71 static void _gcppid(Pid_T *);
   72 static void _gcfsflag(FsFlag_T *);
   73 static void _gcnonexist(NonExist_T *);
   74 static void _gcexist(Exist_T *);
   75 static void _gcgeneric(Generic_T *);
   76 static void _gcath(Auth_T *);
   77 static void _gc_mmonit(Mmonit_T *);
   78 static void _gc_url(URL_T *);
   79 static void _gc_request(Request_T *);
   80 static void _gcssloptions(SslOptions_T o);
   81 static void _gcsecattr(SecurityAttribute_T *);
   82 static void _gcfiledescriptors(Filedescriptors_T *);
   83 
   84 
   85 /**
   86  *  Release allocated memory.
   87  *
   88  *  @file
   89  */
   90 
   91 
   92 /* ------------------------------------------------------------------ Public */
   93 
   94 
   95 void gc() {
   96         Engine_destroyAllow();
   97         if (Run.flags & Run_ProcessEngineEnabled)
   98                 ProcessTree_delete();
   99         if (servicelist)
  100                 _gc_service_list(&servicelist);
  101         if (servicegrouplist)
  102                 _gc_servicegroup(&servicegrouplist);
  103         if (Run.httpd.credentials)
  104                 _gcath(&Run.httpd.credentials);
  105         if (Run.maillist)
  106                 gc_mail_list(&Run.maillist);
  107         if (Run.mailservers)
  108                 _gc_mail_server(&Run.mailservers);
  109         if (Run.mmonits)
  110                 _gc_mmonit(&Run.mmonits);
  111         FREE(Run.eventlist_dir);
  112         FREE(Run.mygroup);
  113         if (Run.httpd.flags & Httpd_Net) {
  114                 FREE(Run.httpd.socket.net.address);
  115                 _gcssloptions(&(Run.httpd.socket.net.ssl));
  116         }
  117         if (Run.httpd.flags & Httpd_Unix)
  118                 FREE(Run.httpd.socket.unix.path);
  119         if (Run.MailFormat.from)
  120                 Address_free(&(Run.MailFormat.from));
  121         if (Run.MailFormat.replyto)
  122                 Address_free(&(Run.MailFormat.replyto));
  123         FREE(Run.MailFormat.subject);
  124         FREE(Run.MailFormat.message);
  125         FREE(Run.mail_hostname);
  126 }
  127 
  128 
  129 void gc_mail_list(Mail_T *m) {
  130         ASSERT(m);
  131         if ((*m)->next)
  132                 gc_mail_list(&(*m)->next);
  133         if ((*m)->from)
  134                 Address_free(&((*m)->from));
  135         if ((*m)->replyto)
  136                 Address_free(&((*m)->replyto));
  137         FREE((*m)->to);
  138         FREE((*m)->subject);
  139         FREE((*m)->message);
  140         FREE(*m);
  141 }
  142 
  143 
  144 void gccmd(command_t *c) {
  145         ASSERT(c && *c);
  146         for (int i = 0; (*c)->arg[i]; i++)
  147                 FREE((*c)->arg[i]);
  148         FREE(*c);
  149 }
  150 
  151 
  152 void gc_event(Event_T *e) {
  153         ASSERT(e && *e);
  154         if ((*e)->next)
  155                 gc_event(&(*e)->next);
  156         (*e)->action = NULL;
  157         FREE((*e)->message);
  158         FREE(*e);
  159 }
  160 
  161 
  162 /* ----------------------------------------------------------------- Private */
  163 
  164 
  165 static void _gcssloptions(SslOptions_T o) {
  166         FREE(o->checksum);
  167         FREE(o->pemfile);
  168         FREE(o->pemchain);
  169         FREE(o->pemkey);
  170         FREE(o->clientpemfile);
  171         FREE(o->ciphers);
  172         FREE(o->CACertificateFile);
  173         FREE(o->CACertificatePath);
  174 }
  175 
  176 
  177 static void _gc_service_list(Service_T *s) {
  178         ASSERT(s&&*s);
  179         if ((*s)->next)
  180                 _gc_service_list(&(*s)->next);
  181         _gc_service(&(*s));
  182 }
  183 
  184 
  185 static void _gc_service(Service_T *s) {
  186         ASSERT(s&&*s);
  187         if ((*s)->program) {
  188                 if ((*s)->program->P)
  189                         Process_free(&(*s)->program->P);
  190                 if ((*s)->program->C)
  191                         Command_free(&(*s)->program->C);
  192                 if ((*s)->program->args)
  193                         gccmd(&(*s)->program->args);
  194                 StringBuffer_free(&((*s)->program->lastOutput));
  195                 StringBuffer_free(&((*s)->program->inprogressOutput));
  196                 FREE((*s)->program);
  197         }
  198         if ((*s)->portlist)
  199                 _gcportlist(&(*s)->portlist);
  200         if ((*s)->socketlist)
  201                 _gcportlist(&(*s)->socketlist);
  202         if ((*s)->filesystemlist)
  203                 _gcfilesystem(&(*s)->filesystemlist);
  204         if ((*s)->icmplist)
  205                 _gcicmp(&(*s)->icmplist);
  206         if ((*s)->maillist)
  207                 gc_mail_list(&(*s)->maillist);
  208         if ((*s)->resourcelist)
  209                 _gcpql(&(*s)->resourcelist);
  210         if ((*s)->timestamplist)
  211                 _gcptl(&(*s)->timestamplist);
  212         if ((*s)->uptimelist)
  213                 _gcuptimelist(&(*s)->uptimelist);
  214         if ((*s)->actionratelist)
  215                 _gcparl(&(*s)->actionratelist);
  216         if ((*s)->sizelist)
  217                 _gcso(&(*s)->sizelist);
  218         if ((*s)->linkstatuslist)
  219                 _gclinkstatus(&(*s)->linkstatuslist);
  220         if ((*s)->linkspeedlist)
  221                 _gclinkspeed(&(*s)->linkspeedlist);
  222         if ((*s)->linksaturationlist)
  223                 _gclinksaturation(&(*s)->linksaturationlist);
  224         if ((*s)->uploadbyteslist)
  225                 _gcbandwidth(&(*s)->uploadbyteslist);
  226         if ((*s)->uploadpacketslist)
  227                 _gcbandwidth(&(*s)->uploadpacketslist);
  228         if ((*s)->downloadbyteslist)
  229                 _gcbandwidth(&(*s)->downloadbyteslist);
  230         if ((*s)->downloadpacketslist)
  231                 _gcbandwidth(&(*s)->downloadpacketslist);
  232         if ((*s)->matchlist)
  233                 _gcmatch(&(*s)->matchlist);
  234         if ((*s)->matchignorelist)
  235                 _gcmatch(&(*s)->matchignorelist);
  236         if ((*s)->checksum)
  237                 _gcchecksum(&(*s)->checksum);
  238         if ((*s)->perm)
  239                 _gcperm(&(*s)->perm);
  240         if ((*s)->statuslist)
  241                 _gcstatus(&(*s)->statuslist);
  242         if ((*s)->every.type == Every_Cron || (*s)->every.type == Every_NotInCron)
  243                 FREE((*s)->every.spec.cron);
  244         if ((*s)->uid)
  245                 _gcuid(&(*s)->uid);
  246         if ((*s)->euid)
  247                 _gcuid(&(*s)->euid);
  248         if ((*s)->gid)
  249                 _gcgid(&(*s)->gid);
  250         if ((*s)->pidlist)
  251                 _gcpid(&(*s)->pidlist);
  252         if ((*s)->ppidlist)
  253                 _gcppid(&(*s)->ppidlist);
  254         if ((*s)->fsflaglist)
  255                 _gcfsflag(&(*s)->fsflaglist);
  256         if ((*s)->nonexistlist)
  257                 _gcnonexist(&(*s)->nonexistlist);
  258         if ((*s)->existlist)
  259                 _gcexist(&(*s)->existlist);
  260         if ((*s)->dependantlist)
  261                 _gcpdl(&(*s)->dependantlist);
  262         if ((*s)->start)
  263                 gccmd(&(*s)->start);
  264         if ((*s)->stop)
  265                 gccmd(&(*s)->stop);
  266         if ((*s)->restart)
  267                 gccmd(&(*s)->restart);
  268         if ((*s)->action_DATA)
  269                 _gc_eventaction(&(*s)->action_DATA);
  270         if ((*s)->action_EXEC)
  271                 _gc_eventaction(&(*s)->action_EXEC);
  272         if ((*s)->action_INVALID)
  273                 _gc_eventaction(&(*s)->action_INVALID);
  274         if ((*s)->action_MONIT_START)
  275                 _gc_eventaction(&(*s)->action_MONIT_START);
  276         if ((*s)->action_MONIT_STOP)
  277                 _gc_eventaction(&(*s)->action_MONIT_STOP);
  278         if ((*s)->action_ACTION)
  279                 _gc_eventaction(&(*s)->action_ACTION);
  280         if ((*s)->eventlist)
  281                 gc_event(&(*s)->eventlist);
  282         if ((*s)->secattrlist)
  283                 _gcsecattr(&(*s)->secattrlist);
  284         if ((*s)->filedescriptorslist)
  285                 _gcfiledescriptors(&(*s)->filedescriptorslist);
  286         switch ((*s)->type) {
  287                 case Service_Directory:
  288                         FREE((*s)->inf.directory);
  289                         break;
  290                 case Service_Fifo:
  291                         FREE((*s)->inf.fifo);
  292                         break;
  293                 case Service_File:
  294                         FREE((*s)->inf.file);
  295                         break;
  296                 case Service_Filesystem:
  297                         FREE((*s)->inf.filesystem);
  298                         break;
  299                 case Service_Net:
  300                         Link_free(&((*s)->inf.net->stats));
  301                         FREE((*s)->inf.net);
  302                         break;
  303                 case Service_Process:
  304                         FREE((*s)->inf.process);
  305                         break;
  306                 default:
  307                         break;
  308         }
  309         StringBuffer_free(&((*s)->name_htmlescaped));
  310         FREE((*s)->name_urlescaped);
  311         FREE((*s)->name);
  312         FREE((*s)->path);
  313         (*s)->next = NULL;
  314         FREE(*s);
  315 }
  316 
  317 
  318 static void _gc_servicegroup(ServiceGroup_T *sg) {
  319         ASSERT(sg && *sg);
  320         if ((*sg)->next)
  321                 _gc_servicegroup(&(*sg)->next);
  322         List_free(&(*sg)->members);
  323         FREE((*sg)->name);
  324         FREE(*sg);
  325 }
  326 
  327 
  328 static void _gc_request(Request_T *r) {
  329         ASSERT(r);
  330         if ((*r)->url)
  331                 _gc_url(&(*r)->url);
  332         if ((*r)->regex)
  333                 regfree((*r)->regex);
  334         FREE((*r)->regex);
  335         FREE(*r);
  336 }
  337 
  338 
  339 static void _gc_url(URL_T *url) {
  340         ASSERT(url);
  341         FREE((*url)->url);
  342         FREE((*url)->protocol);
  343         FREE((*url)->user);
  344         FREE((*url)->password);
  345         FREE((*url)->hostname);
  346         FREE((*url)->path);
  347         FREE((*url)->query);
  348         FREE(*url);
  349 }
  350 
  351 
  352 static void _gc_mail_server(MailServer_T *s) {
  353         if (! s || ! *s)
  354                 return;
  355         if ((*s)->next)
  356                 _gc_mail_server(&(*s)->next);
  357         _gcssloptions(&((*s)->ssl));
  358         FREE((*s)->host);
  359         FREE((*s)->username);
  360         FREE((*s)->password);
  361         FREE(*s);
  362 }
  363 
  364 
  365 static void _gc_action(Action_T *a) {
  366         ASSERT(a&&*a);
  367         if ((*a)->exec)
  368                 gccmd(&(*a)->exec);
  369         FREE(*a);
  370 }
  371 
  372 
  373 static void _gc_eventaction(EventAction_T *e) {
  374         ASSERT(e&&*e);
  375         _gc_action(&(*e)->failed);
  376         _gc_action(&(*e)->succeeded);
  377         FREE(*e);
  378 }
  379 
  380 
  381 static void _gcportlist(Port_T *p) {
  382         ASSERT(p&&*p);
  383         if ((*p)->next)
  384                 _gcportlist(&(*p)->next);
  385         if ((*p)->action)
  386                 _gc_eventaction(&(*p)->action);
  387         if ((*p)->url_request)
  388                 _gc_request(&(*p)->url_request);
  389         if ((*p)->family == Socket_Unix)
  390                 FREE((*p)->target.unix.pathname);
  391         else
  392                 _gcssloptions(&((*p)->target.net.ssl.options));
  393         FREE((*p)->hostname);
  394         FREE((*p)->outgoing.ip);
  395         if ((*p)->protocol->check == check_http) {
  396                 FREE((*p)->parameters.http.username);
  397                 FREE((*p)->parameters.http.password);
  398                 FREE((*p)->parameters.http.request);
  399                 FREE((*p)->parameters.http.checksum);
  400                 if ((*p)->parameters.http.headers) {
  401                         List_T l = (*p)->parameters.http.headers;
  402                         while (List_length(l) > 0) {
  403                                 char *s = List_pop(l);
  404                                 FREE(s);
  405                         }
  406                         List_free(&(*p)->parameters.http.headers);
  407                 }
  408         } else if ((*p)->protocol->check == check_generic) {
  409                 if ((*p)->parameters.generic.sendexpect)
  410                         _gcgeneric(&(*p)->parameters.generic.sendexpect);
  411         } else if ((*p)->protocol->check == check_mqtt) {
  412                 FREE((*p)->parameters.mqtt.username);
  413                 FREE((*p)->parameters.mqtt.password);
  414         } else if ((*p)->protocol->check == check_mysql) {
  415                 FREE((*p)->parameters.mysql.username);
  416                 FREE((*p)->parameters.mysql.password);
  417                 FREE((*p)->parameters.mysql.rsaChecksum);
  418         } else if ((*p)->protocol->check == check_sip) {
  419                 FREE((*p)->parameters.sip.target);
  420         } else if ((*p)->protocol->check == check_smtp) {
  421                 FREE((*p)->parameters.smtp.username);
  422                 FREE((*p)->parameters.smtp.password);
  423         } else if ((*p)->protocol->check == check_radius) {
  424                 FREE((*p)->parameters.radius.secret);
  425         } else if ((*p)->protocol->check == check_websocket) {
  426                 FREE((*p)->parameters.websocket.host);
  427                 FREE((*p)->parameters.websocket.origin);
  428                 FREE((*p)->parameters.websocket.request);
  429         } else if ((*p)->protocol->check == check_apache_status) {
  430                 FREE((*p)->parameters.apachestatus.path);
  431                 FREE((*p)->parameters.apachestatus.username);
  432                 FREE((*p)->parameters.apachestatus.password);
  433         }
  434         FREE(*p);
  435 }
  436 
  437 
  438 static void _gcfilesystem(FileSystem_T *d) {
  439         ASSERT(d&&*d);
  440         if ((*d)->next)
  441                 _gcfilesystem(&(*d)->next);
  442         if ((*d)->action)
  443                 _gc_eventaction(&(*d)->action);
  444         FREE(*d);
  445 }
  446 
  447 
  448 static void _gcicmp(Icmp_T *i) {
  449         ASSERT(i&&*i);
  450         if ((*i)->next)
  451                 _gcicmp(&(*i)->next);
  452         FREE((*i)->outgoing.ip);
  453         if ((*i)->action)
  454                 _gc_eventaction(&(*i)->action);
  455         FREE(*i);
  456 }
  457 
  458 
  459 static void _gcpql(Resource_T *q) {
  460         ASSERT(q);
  461         if ((*q)->next)
  462                 _gcpql(&(*q)->next);
  463         if ((*q)->action)
  464                 _gc_eventaction(&(*q)->action);
  465         FREE(*q);
  466 }
  467 
  468 
  469 static void _gcptl(Timestamp_T *p) {
  470         ASSERT(p);
  471         if ((*p)->next)
  472                 _gcptl(&(*p)->next);
  473         if ((*p)->action)
  474                 _gc_eventaction(&(*p)->action);
  475         FREE(*p);
  476 }
  477 
  478 
  479 static void _gcuptimelist(Uptime_T *u) {
  480         ASSERT(u);
  481         if ((*u)->next)
  482                 _gcuptimelist(&(*u)->next);
  483         if ((*u)->action)
  484                 _gc_eventaction(&(*u)->action);
  485         FREE(*u);
  486 }
  487 
  488 
  489 static void _gcparl(ActionRate_T *ar) {
  490         ASSERT(ar);
  491         if ((*ar)->next)
  492                 _gcparl(&(*ar)->next);
  493         if ((*ar)->action)
  494                 _gc_eventaction(&(*ar)->action);
  495         FREE(*ar);
  496 }
  497 
  498 
  499 static void _gcso(Size_T *s) {
  500         ASSERT(s);
  501         if ((*s)->next)
  502                 _gcso(&(*s)->next);
  503         if ((*s)->action)
  504                 _gc_eventaction(&(*s)->action);
  505         FREE(*s);
  506 }
  507 
  508 static void _gclinkstatus(LinkStatus_T *l) {
  509         ASSERT(l);
  510         if ((*l)->next)
  511                 _gclinkstatus(&(*l)->next);
  512         if ((*l)->action)
  513                 _gc_eventaction(&(*l)->action);
  514         FREE(*l);
  515 }
  516 
  517 
  518 static void _gclinkspeed(LinkSpeed_T *l) {
  519         ASSERT(l);
  520         if ((*l)->next)
  521                 _gclinkspeed(&(*l)->next);
  522         if ((*l)->action)
  523                 _gc_eventaction(&(*l)->action);
  524         FREE(*l);
  525 }
  526 
  527 
  528 static void _gclinksaturation(LinkSaturation_T *l) {
  529         ASSERT(l);
  530         if ((*l)->next)
  531                 _gclinksaturation(&(*l)->next);
  532         if ((*l)->action)
  533                 _gc_eventaction(&(*l)->action);
  534         FREE(*l);
  535 }
  536 
  537 
  538 static void _gcbandwidth(Bandwidth_T *b) {
  539         ASSERT(b);
  540         if ((*b)->next)
  541                 _gcbandwidth(&(*b)->next);
  542         if ((*b)->action)
  543                 _gc_eventaction(&(*b)->action);
  544         FREE(*b);
  545 }
  546 
  547 static void _gcmatch(Match_T *s) {
  548         ASSERT(s);
  549         if ((*s)->next)
  550                 _gcmatch(&(*s)->next);
  551         if ((*s)->action)
  552                 _gc_eventaction(&(*s)->action);
  553         FREE((*s)->match_path);
  554         FREE((*s)->match_string);
  555         if ((*s)->regex_comp) {
  556                 regfree((*s)->regex_comp);
  557                 FREE((*s)->regex_comp);
  558         }
  559         FREE(*s);
  560 }
  561 
  562 
  563 static void _gcchecksum(Checksum_T *s) {
  564         ASSERT(s);
  565         if ((*s)->action)
  566                 _gc_eventaction(&(*s)->action);
  567         FREE(*s);
  568 }
  569 
  570 
  571 static void _gcperm(Perm_T *s) {
  572         ASSERT(s);
  573         if ((*s)->action)
  574                 _gc_eventaction(&(*s)->action);
  575         FREE(*s);
  576 }
  577 
  578 
  579 static void _gcstatus(Status_T *s) {
  580         ASSERT(s);
  581         if ((*s)->next)
  582                 _gcstatus(&(*s)->next);
  583         if ((*s)->action)
  584                 _gc_eventaction(&(*s)->action);
  585         FREE(*s);
  586 }
  587 
  588 
  589 static void _gcuid(Uid_T *s) {
  590         ASSERT(s);
  591         if ((*s)->action)
  592                 _gc_eventaction(&(*s)->action);
  593         FREE(*s);
  594 }
  595 
  596 
  597 static void _gcgid(Gid_T *s) {
  598         ASSERT(s);
  599         if ((*s)->action)
  600                 _gc_eventaction(&(*s)->action);
  601         FREE(*s);
  602 }
  603 
  604 
  605 static void _gcpid(Pid_T *s) {
  606         ASSERT(s);
  607         if ((*s)->next)
  608                 _gcpid(&(*s)->next);
  609         if ((*s)->action)
  610                 _gc_eventaction(&(*s)->action);
  611         FREE(*s);
  612 }
  613 
  614 
  615 static void _gcppid(Pid_T *s) {
  616         ASSERT(s);
  617         if ((*s)->next)
  618                 _gcppid(&(*s)->next);
  619         if ((*s)->action)
  620                 _gc_eventaction(&(*s)->action);
  621         FREE(*s);
  622 }
  623 
  624 
  625 static void _gcfsflag(FsFlag_T *s) {
  626         ASSERT(s);
  627         if ((*s)->next)
  628                 _gcfsflag(&(*s)->next);
  629         if ((*s)->action)
  630                 _gc_eventaction(&(*s)->action);
  631         FREE(*s);
  632 }
  633 
  634 
  635 static void _gcnonexist(NonExist_T *s) {
  636         ASSERT(s);
  637         if ((*s)->next)
  638                 _gcnonexist(&(*s)->next);
  639         if ((*s)->action)
  640                 _gc_eventaction(&(*s)->action);
  641         FREE(*s);
  642 }
  643 
  644 
  645 static void _gcexist(Exist_T *s) {
  646         ASSERT(s);
  647         if ((*s)->next)
  648                 _gcexist(&(*s)->next);
  649         if ((*s)->action)
  650                 _gc_eventaction(&(*s)->action);
  651         FREE(*s);
  652 }
  653 
  654 
  655 static void _gcpdl(Dependant_T *d) {
  656         ASSERT(d);
  657         if ((*d)->next)
  658                 _gcpdl(&(*d)->next);
  659         StringBuffer_free(&((*d)->dependant_htmlescaped));
  660         FREE((*d)->dependant_urlescaped);
  661         FREE((*d)->dependant);
  662         FREE(*d);
  663 }
  664 
  665 
  666 static void _gcgeneric(Generic_T *g) {
  667         ASSERT(g);
  668         if ((*g)->next)
  669                 _gcgeneric(&(*g)->next);
  670         FREE((*g)->send);
  671         if ((*g)->expect != NULL)
  672                 regfree((*g)->expect);
  673         FREE((*g)->expect);
  674         FREE(*g);
  675 
  676 }
  677 
  678 
  679 static void _gcath(Auth_T *c) {
  680         ASSERT(c);
  681         if ((*c)->next)
  682                 _gcath(&(*c)->next);
  683         FREE((*c)->uname);
  684         FREE((*c)->passwd);
  685         FREE((*c)->groupname);
  686         FREE(*c);
  687 }
  688 
  689 
  690 static void _gc_mmonit(Mmonit_T *recv) {
  691         ASSERT(recv);
  692         if ((*recv)->next)
  693                 _gc_mmonit(&(*recv)->next);
  694         _gc_url(&(*recv)->url);
  695         _gcssloptions(&((*recv)->ssl));
  696         FREE(*recv);
  697 }
  698 
  699 
  700 static void _gcsecattr(SecurityAttribute_T *s) {
  701         ASSERT(s && *s);
  702         if ((*s)->next)
  703                 _gcsecattr(&(*s)->next);
  704         if ((*s)->action)
  705                 _gc_eventaction(&(*s)->action);
  706         FREE((*s)->attribute);
  707         FREE(*s);
  708 }
  709 
  710 
  711 static void _gcfiledescriptors(Filedescriptors_T *o) {
  712         ASSERT(o && *o);
  713         if ((*o)->next)
  714                 _gcfiledescriptors(&(*o)->next);
  715         if ((*o)->action)
  716                 _gc_eventaction(&(*o)->action);
  717         FREE(*o);
  718 }
  719