if (index(param_locale, ',')) {
int ind = index(param_locale, ',') - param_locale;
int i;
- for ( i = 0; i < ind - 1 && i < 128; i++ )
+ for ( i = 0; i < ind && i < 128; i++ )
buffer_add_char( osrf_locale_buf, param_locale[i] );
} else {
buffer_add( osrf_locale_buf, param_locale );
}
/* use the sender's locale, or the global default */
+ if (current_locale)
+ free( current_locale );
+
tmp = jsonObjectGetKey(message, "locale");
if(tmp) {
new_msg->sender_locale = jsonObjectToSimpleString(tmp);
- if (current_locale)
- free( current_locale );
current_locale = strdup( new_msg->sender_locale );
} else {
current_locale = NULL;