Skip to content

Commit

Permalink
[dbops] fix bad usage of non-static variable
Browse files Browse the repository at this point in the history
Use the cols pointer (which is static) and not the str_cols which are valid only during a mem realloc
  • Loading branch information
bogdan-iancu committed Mar 12, 2024
1 parent 12b9ba4 commit 5b7d83d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/dbops/dbops_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,8 @@ static inline int _json_to_cols(cJSON *Jcols, db_key_t** _c)

/* iterate again to fill in the cols */
for( col=Jcols->child,i=0 ; col ; col=col->next,i++ ) {
str_cols[i].s = col->valuestring;
str_cols[i].len = strlen(col->valuestring);
cols[i]->s = col->valuestring;
cols[i]->len = strlen(col->valuestring);
}

*_c = cols;
Expand Down

0 comments on commit 5b7d83d

Please sign in to comment.