rem: db_free_query(db_handle,res);
add: dbf.free_result(db_handle,res);
context: static int avp_query_db(str* key){    int       err=-1;    db_key_t  cols[2];    db_key_t  keys[1];    db_op_t   ops [1];    db_val_t  vals[1];    db_res_t* res=0;    db_row_t* cur_row=0;    int_str name,val;    str name_str,val_str;    cols[0] = attr_column;    cols[1] = val_column;    keys[0] = key_column;    ops[0]  = "=";    VAL_TYPE(&(vals[0])) = DB_STR;    VAL_NULL(&(vals[0])) = 0;    VAL_STR(&(vals[0]))  = *key;    db_use_table(db_handle,avp_table);    err = db_query(db_handle,keys,ops,vals,cols,1,2,0,&res);    if(err){	LOG(L_ERR,"ERROR: avp: db_query() failed.");	err=-1;	goto error;    }    name.s = &name_str;    val.s  = &val_str;    if(res->n==0){	DBG("load_avp: no AVPs found in the DB\n");	err=-1;	goto error;    }    for( cur_row = res->rows+res->n-1; 	 cur_row >= res->rows; cur_row--){	name_str.s = (char*)VAL_STRING(&(cur_row->values[0]));	name_str.len = strlen(name_str.s);	val_str.s = (char*)VAL_STRING(&(cur_row->values[1]));	val_str.len = strlen(val_str.s);		err = add_avp(AVP_NAME_STR|AVP_VAL_STR,name,val);	if(err != 0){	    LOG(L_ERR,"ERROR: avp: add_avp() failed\n");	    err=-1;	    goto error;	}	DBG("avp_load: AVP '%s'/'%s' has been added\n",	    name_str.s,val_str.s);    }    err = 1; error:    db_free_query(db_handle,res);    return err;}