Tinkered with the memory pointers in sitemap.c to try to hopefully fix the random...
authorArt Cancro <ajc@uncensored.citadel.org>
Sat, 23 Jul 2011 02:25:58 +0000 (22:25 -0400)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 21:38:51 +0000 (21:38 +0000)
webcit/gettext.c
webcit/sitemap.c

index c4920cea7c3082166215be18c73f378be66d8bd1..30a73258838847a8b3f75fb53b79dfcc52b5815b 100644 (file)
@@ -469,8 +469,10 @@ SessionNewModule_GETTEXT
 (wcsession *sess)
 {
 #ifdef ENABLE_NLS
-       if (!sess->Hdr->HR.Static && 
-           (sess->Hdr->HR.browser_language != NULL)) {
+       if (    (sess != NULL)
+               && (!sess->Hdr->HR.Static)
+               && (sess->Hdr->HR.browser_language != NULL)
+       ) {
                httplang_to_locale(sess->Hdr->HR.browser_language, sess);
        }
 #endif
index 37fe310a80ba696f69fc3dc6cc18bfea5e875be8..c79c82441d38f95a86fdf8016613e7e09165b9e6 100644 (file)
@@ -129,11 +129,11 @@ void sitemap_do_wiki(void) {
  * Entry point for RSS feed generator
  */
 void sitemap(void) {
-       HashList *roomlist;
-       HashPos *it;
-       long HKlen;
-       const char *HashKey;
-       folder *room;
+       HashList *roomlist = NULL;
+       HashPos *it = NULL;
+       long HKlen = 0;
+       const char *HashKey = NULL;
+       folder *room = NULL;
 
        output_headers(0, 0, 0, 0, 1, 0);
        hprintf("Content-type: text/xml\r\n");
@@ -149,7 +149,9 @@ void sitemap(void) {
        wc_printf("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\r\n");
 
        roomlist = GetRoomListHashLKRA(NULL, NULL);
+       if (!roomlist) syslog(LOG_CRIT, "GetRoomListHashLKRA() FAILED!");
        it = GetNewHashPos(roomlist, 0);
+       if (!it) syslog(LOG_CRIT, "GetNewHashPos() FAILED!");
 
        while (GetNextHashPos(roomlist, it, &HKlen, &HashKey, (void *)&room))
        {
@@ -172,8 +174,7 @@ void sitemap(void) {
        }
 
        DeleteHashPos(&it);
-       /* No need to DeleteHash(&roomlist) -- it will be freed when the session closes */
-
+       DeleteHash(&WC->Rooms);         /* roomlist is actually a pointer to WC->Rooms */
        wc_printf("</urlset>\r\n");
        wDumpContent(0);
 }