free(sessions_to_kill->cache_fold);
}
free_attachments(sessions_to_kill);
+ free_march_list(sessions_to_kill);
pthread_mutex_unlock(&sessions_to_kill->SessionMutex);
sptr = sessions_to_kill->next;
free(sessions_to_kill);
}
/**
- * \brief some bytefoo ????
- * \param in the string to chop
- * \param len the length of the string
- * \return the corrosponding integer value
+ * \brief Convert unpacked hex string to an integer
+ * \param in Input hex string
+ * \param len the length of the string
+ * \return the corrosponding integer value
*/
int xtoi(char *in, size_t len)
{
- int val = 0;
- while (isxdigit((byte) *in) && (len-- > 0)) {
- char c = *in++;
- val <<= 4;
- val += isdigit((unsigned char)c)
- ? (c - '0')
- : (tolower((unsigned char)c) - 'a' + 10);
- }
- return val;
+ int val = 0;
+ char c = 0;
+ while (isxdigit((byte) *in) && (len-- > 0))
+ {
+ c = *in++;
+ val <<= 4;
+ val += isdigit((unsigned char)c)
+ ? (c - '0')
+ : (tolower((unsigned char)c) - 'a' + 10);
+ }
+ return val;
}
/**
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';
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. */
while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
line_length = strlen(buf);
buffer_length = content_length + line_length + 2;
- msg = realloc(msg, buffer_length);
- if (msg == NULL) {
+ ptr = realloc(msg, buffer_length);
+ if (ptr == NULL) {
wprintf("<b>");
wprintf(_("realloc() error! couldn't get %d bytes: %s"),
buffer_length + 1,
strerror(errno));
wprintf("</b><br /><br />\n");
+ while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
+ /** flush */
+ }
+ free(msg);
return;
}
+ msg = ptr;
strcpy(&msg[content_length], buf);
content_length += line_length;
strcpy(&msg[content_length], "\n");
ic = ctdl_iconv_open("UTF-8", charset);
if (ic != (iconv_t)(-1) ) {
- obuf = malloc(1024);
obuflen = 1024;
obuf = (char *) malloc(obuflen);
osav = obuf;
}
+/**
+ * \brief Free a session's march list
+ *
+ * \param wcf Pointer to session being cleared
+ */
+void free_march_list(struct wcsession *wcf)
+{
+ struct march *mptr;
+
+ while (wcf->march == NULL) {
+ mptr = wcf->march->next;
+ free(wcf->march);
+ wcf->march = mptr;
+ }
+
+}
+
+
+
/**
* \brief remove a room from the march list
*/
*/
void gotonext(void)
{
- char buf[SIZ];
+ char buf[256];
struct march *mptr, *mptr2;
char next_room[128];
*/
int num_tokens(char *source, char tok)
{
- int a;
+ int a = 0;
int count = 1;
if (source == NULL)
void CtdlEncodeBase64(char *dest, const char *source, size_t sourcelen);
int CtdlDecodeBase64(char *dest, const char *source, size_t length);
void free_attachments(struct wcsession *sess);
+void free_march_list(struct wcsession *wcf);
void set_room_policy(void);
void display_inetconf(void);
void save_inetconf(void);