add some asserts, chasing a valgrind message

This commit is contained in:
Enno Rehling 2014-06-26 21:27:50 -07:00
parent 5e835618f3
commit c5cf8bb3be
1 changed files with 3 additions and 0 deletions

View File

@ -207,6 +207,7 @@ static order_data *create_data(keyword_t kwd, const char *sptr, int lindex)
locale_array[lindex]->study_orders[sk] = data;
data->_keyword = kwd;
data->_lindex = lindex;
assert(data->_lindex>=0);
if (strchr(skname, ' ') != NULL) {
size_t len = strlen(skname);
data->_str = malloc(len + 3);
@ -232,6 +233,7 @@ static order_data *create_data(keyword_t kwd, const char *sptr, int lindex)
locale_array[lindex]->short_orders[kwd] = data;
data->_keyword = kwd;
data->_lindex = lindex;
assert(data->_lindex>=0);
data->_str = NULL;
data->_refcount = 1;
}
@ -241,6 +243,7 @@ static order_data *create_data(keyword_t kwd, const char *sptr, int lindex)
data = (order_data *) malloc(sizeof(order_data));
data->_keyword = kwd;
data->_lindex = lindex;
assert(data->_lindex>=0);
data->_str = s ? _strdup(s) : NULL;
data->_refcount = 1;
return data;