X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fclient.c;h=426b2897a2423ce30d3cd2a10c10fe31371d34cf;hb=6969c366e0d8c8fa7e57f2cdd8c93669561b96a4;hp=618dfcf9f452c3991eadeea8a6f44d01e39bd9be;hpb=b3adf9aaa551ef92c83b6ea5951882164c277b24;p=pazpar2-moved-to-github.git diff --git a/src/client.c b/src/client.c index 618dfcf..426b289 100644 --- a/src/client.c +++ b/src/client.c @@ -969,6 +969,8 @@ int client_destroy(struct client *c) xfree(c->addinfo); c->addinfo = 0; xfree(c->id); + xfree(c->sort_strategy); + xfree(c->sort_criteria); assert(!c->connection); facet_limits_destroy(c->facet_limits); @@ -1369,14 +1371,11 @@ int client_parse_query(struct client *cl, const char *query, int client_parse_sort(struct client *cl, struct reclist_sortparms *sp) { - struct session *se = client_get_session(cl); if (sp) - { /* first entry is current sorting ! */ + { const char *sort_strategy_and_spec = - get_strategy_plus_sort(cl, se->sorted_results->name); - - int increasing = se->sorted_results->increasing; - // int type = se->sorted_results->type; + get_strategy_plus_sort(cl, sp->name); + int increasing = sp->increasing; if (sort_strategy_and_spec && strlen(sort_strategy_and_spec) < 40) { char strategy[50], *p; @@ -1398,18 +1397,24 @@ int client_parse_sort(struct client *cl, struct reclist_sortparms *sp) if (!cl->sort_criteria || strcmp(cl->sort_criteria, p)) cl->same_search = 0; if (cl->same_search == 0) { - cl->sort_strategy = nmem_strdup(se->nmem, strategy); - cl->sort_criteria = nmem_strdup(se->nmem, p); + xfree(cl->sort_strategy); + cl->sort_strategy = xstrdup(strategy); + xfree(cl->sort_criteria); + cl->sort_criteria = xstrdup(p); } } else { yaz_log(YLOG_LOG, "Client %s: Invalid sort strategy and spec found %s", client_get_id(cl), sort_strategy_and_spec); + xfree(cl->sort_strategy); cl->sort_strategy = 0; + xfree(cl->sort_criteria); cl->sort_criteria = 0; } } else { yaz_log(YLOG_LOG, "Client %s: No sort strategy and spec found.", client_get_id(cl)); + xfree(cl->sort_strategy); cl->sort_strategy = 0; + xfree(cl->sort_criteria); cl->sort_criteria = 0; }