LCOV - code coverage report
Current view: top level - lib/digest-md5 - free.c (source / functions) Hit Total Coverage
Test: GNU SASL Lines: 19 19 100.0 %
Date: 2012-05-28 Functions: 3 3 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 2 100.0 %

           Branch data     Line data    Source code
       1                 :            : /* free.h --- Free allocated data in DIGEST-MD5 token structures.
       2                 :            :  * Copyright (C) 2004-2012 Simon Josefsson
       3                 :            :  *
       4                 :            :  * This file is part of GNU SASL Library.
       5                 :            :  *
       6                 :            :  * GNU SASL Library is free software; you can redistribute it and/or
       7                 :            :  * modify it under the terms of the GNU Lesser General Public License
       8                 :            :  * as published by the Free Software Foundation; either version 2.1 of
       9                 :            :  * the License, or (at your option) any later version.
      10                 :            :  *
      11                 :            :  * GNU SASL Library is distributed in the hope that it will be useful,
      12                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14                 :            :  * Lesser General Public License for more details.
      15                 :            :  *
      16                 :            :  * You should have received a copy of the GNU Lesser General Public
      17                 :            :  * License along with GNU SASL Library; if not, write to the Free
      18                 :            :  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
      19                 :            :  * Boston, MA 02110-1301, USA.
      20                 :            :  *
      21                 :            :  */
      22                 :            : 
      23                 :            : /* Get prototypes. */
      24                 :            : #include "free.h"
      25                 :            : 
      26                 :            : /* Get free. */
      27                 :            : #include <stdlib.h>
      28                 :            : 
      29                 :            : /* Get memset. */
      30                 :            : #include <string.h>
      31                 :            : 
      32                 :            : void
      33                 :         46 : digest_md5_free_challenge (digest_md5_challenge * c)
      34                 :            : {
      35                 :            :   size_t i;
      36                 :            : 
      37         [ +  + ]:         58 :   for (i = 0; i < c->nrealms; i++)
      38                 :         12 :     free (c->realms[i]);
      39                 :         46 :   free (c->realms);
      40                 :         46 :   free (c->nonce);
      41                 :            : 
      42                 :         46 :   memset (c, 0, sizeof (*c));
      43                 :         46 : }
      44                 :            : 
      45                 :            : void
      46                 :         46 : digest_md5_free_response (digest_md5_response * r)
      47                 :            : {
      48                 :         46 :   free (r->username);
      49                 :         46 :   free (r->realm);
      50                 :         46 :   free (r->nonce);
      51                 :         46 :   free (r->cnonce);
      52                 :         46 :   free (r->digesturi);
      53                 :         46 :   free (r->authzid);
      54                 :            : 
      55                 :         46 :   memset (r, 0, sizeof (*r));
      56                 :         46 : }
      57                 :            : 
      58                 :            : void
      59                 :         46 : digest_md5_free_finish (digest_md5_finish * f)
      60                 :            : {
      61                 :         46 :   memset (f, 0, sizeof (*f));
      62                 :         46 : }

Generated by: LCOV version 1.9