fixed endless loop in lang.c
authorpk910 <philipp@zoelle1.de>
Sun, 12 Feb 2012 21:10:52 +0000 (22:10 +0100)
committerpk910 <philipp@zoelle1.de>
Sun, 12 Feb 2012 21:10:52 +0000 (22:10 +0100)
src/lang.c

index b56322ce2e4421c7201e6d32732ba1a882d831ed..8427806070efd1a0faeb30e8de3cadb7af19256e 100644 (file)
@@ -146,7 +146,10 @@ void register_language_string(struct language *lang, char *ident, char *text) {
             return;
         }
         lang_entry->ident = strdup(ident);
-    }
+        lang_entry->next = lang->entrys[cindex];
+        lang->entrys[cindex] = lang_entry;
+    } else
+        free(lang_entry->text); //free old text (new one will be set below)
     //replace all:
     //$b to \002
     //$k to \003
@@ -178,8 +181,6 @@ void register_language_string(struct language *lang, char *ident, char *text) {
         }
     } while(a);
     lang_entry->text = strdup(tmp);
-    lang_entry->next = lang->entrys[cindex];
-    lang->entrys[cindex] = lang_entry;
 }
 
 char *get_language_string(struct UserNode *user, const char* msg_ident) {