admserv/cgi-src40/htmladmin.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
New commits:
commit 4ec23c03450d45639282c173d2e095c4023876bb
Author: Noriko Hosoi <nhosoi(a)totoro.sjc.redhat.com>
Date: Fri Mar 23 13:13:08 2012 -0700
If htmladmin fails to connect to the server, the cgi could crash.
This patch checks the flag for the server status and avoids the
unnecessary free.
diff --git a/admserv/cgi-src40/htmladmin.c b/admserv/cgi-src40/htmladmin.c
index 09d0ad0..7110526 100644
--- a/admserv/cgi-src40/htmladmin.c
+++ b/admserv/cgi-src40/htmladmin.c
@@ -1175,8 +1175,8 @@ int output_topology(AdmldapInfo ldapInfo,
char *admin_url;
char *server_host;
int *server_port;
- int running;
- char *href;
+ int running = 0;
+ char *href = NULL;
char *info_link;
char *log_link;
@@ -1232,7 +1232,10 @@ int output_topology(AdmldapInfo ldapInfo,
free((void *)dn_escaped);
free((void *)val_escaped);
- PR_smprintf_free((char *)href);
+ if (running == 1) {
+ PR_smprintf_free((char *)href);
+ href = NULL;
+ }
PR_smprintf_free((char *)info_link);
PR_smprintf_free((char *)log_link);
} else if(strstr(ldap_get_dn(server, sie_entry), "Directory")) {
@@ -1276,7 +1279,9 @@ int output_topology(AdmldapInfo ldapInfo,
free((void *)dn_escaped);
free((void *)val_escaped);
free((void *)host_escaped);
- PR_smprintf_free((char *)href);
+ if (href) {
+ PR_smprintf_free((char *)href);
+ }
PR_smprintf_free((char *)info_link);
PR_smprintf_free((char *)log_link);
PR_smprintf_free((char *)repl_link);
Show replies by date