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
32void
33digest_md5_free_challenge (digest_md5_challenge * c)
34{
35 size_t i;
36
37 for (i = 0; i < c->nrealms; i++)
38 free (c->realms[i]);
39 free (c->realms);
40 free (c->nonce);
41
42 memset (c, 0, sizeof (*c));
43}
44
45void
46digest_md5_free_response (digest_md5_response * r)
47{
48 free (r->username);
49 free (r->realm);
50 free (r->nonce);
51 free (r->cnonce);
52 free (r->digesturi);
53 free (r->authzid);
54
55 memset (r, 0, sizeof (*r));
56}
57
58void
59digest_md5_free_finish (digest_md5_finish * f)
60{
61 memset (f, 0, sizeof (*f));
62}
63