Fixed a couple of memory leaks detected by Valgrind.
[citadel.git] / webcit / gettext.c
index e84e3bab47e03a43dc7628060f198a186cc6ae59..70af1ef5a9714c824061d1081aa39376ca875aa9 100644 (file)
@@ -3,6 +3,7 @@
  */
 /**
  * \defgroup LocaleHeaderParser Parse the browser http locale headers and set the NLS stuff.
+ * \ingroup WebcitHttpServer 
  */
 /*@{*/
 /** we need _GNU_SOURCE for various functions arround the NLS-Stuff */
@@ -59,8 +60,6 @@ void httplang_to_locale(char *LocaleString)
        int nBest;
        int nParts;
        char *search = (char *) malloc(len);
-       // locale_t my_Locale;
-       // locale_t my_Empty_Locale;
        
        memcpy(search, LocaleString, len);
        search[len] = '\0';
@@ -146,7 +145,9 @@ void httplang_to_locale(char *LocaleString)
                nBest=0;
        WC->selected_language=nBest;
        lprintf(9, "language found: %s\n", AvailLang[WC->selected_language]);
-       //      set_selected_language(selected_locale);
+       if (search != NULL) {
+               free(search);
+       }
 }
 
 /* TODO: we skip the language weightening so far. */