aboutsummaryrefslogtreecommitdiff
path: root/doc/examples/basicauthentication.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-10-09 22:41:11 +0200
committerChristian Grothoff <christian@grothoff.org>2017-10-09 22:41:11 +0200
commit330a40552cbd26ebcdf25bf209e12697ac330737 (patch)
tree7db9138ce0dfb398aae4aa560ea43cbe3baeedd6 /doc/examples/basicauthentication.c
parent181ac3c59fffd599cd6b351940bffd5c6c930fd7 (diff)
downloadlibmicrohttpd-330a40552cbd26ebcdf25bf209e12697ac330737.tar.gz
libmicrohttpd-330a40552cbd26ebcdf25bf209e12697ac330737.zip
add MHD_free(), as suggested by Tim on the mailinglist
Diffstat (limited to 'doc/examples/basicauthentication.c')
-rw-r--r--doc/examples/basicauthentication.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/doc/examples/basicauthentication.c b/doc/examples/basicauthentication.c
index 0e13a2ee..88cb79b7 100644
--- a/doc/examples/basicauthentication.c
+++ b/doc/examples/basicauthentication.c
@@ -42,12 +42,13 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
42 return MHD_YES; 42 return MHD_YES;
43 } 43 }
44 pass = NULL; 44 pass = NULL;
45 user = MHD_basic_auth_get_username_password (connection, &pass); 45 user = MHD_basic_auth_get_username_password (connection,
46 fail = ( (user == NULL) || 46 &pass);
47 fail = ( (NULL == user) ||
47 (0 != strcmp (user, "root")) || 48 (0 != strcmp (user, "root")) ||
48 (0 != strcmp (pass, "pa$$w0rd") ) ); 49 (0 != strcmp (pass, "pa$$w0rd") ) );
49 if (user != NULL) free (user); 50 if (NULL != user) MHD_free (user);
50 if (pass != NULL) free (pass); 51 if (NULL != pass) MHD_free (pass);
51 if (fail) 52 if (fail)
52 { 53 {
53 const char *page = "<html><body>Go away.</body></html>"; 54 const char *page = "<html><body>Go away.</body></html>";