From: Adam Dickmeiss Date: Fri, 24 Jun 2011 09:55:03 +0000 (+0200) Subject: session_shared: fix ref to freed memory X-Git-Tag: v1.2.9~11 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=b9e82b9adecd1dbd44e54c28d6b0d1336721bfec;p=metaproxy-moved-to-github.git session_shared: fix ref to freed memory Would occur if a search response had non-surrogate diagnostics. --- diff --git a/src/filter_session_shared.cpp b/src/filter_session_shared.cpp index 85d706d..dbbd0fc 100644 --- a/src/filter_session_shared.cpp +++ b/src/filter_session_shared.cpp @@ -85,6 +85,7 @@ namespace metaproxy_1 { const yazpp_1::Yaz_Z_Query &query); bool search( Package &frontend_package, + Package &search_package, const Z_APDU *apdu_req, const BackendInstancePtr bp, Z_Records **z_records); @@ -507,14 +508,11 @@ static int get_diagnostic(Z_DefaultDiagFormat *r) bool yf::SessionShared::BackendSet::search( mp::Package &frontend_package, + mp::Package &search_package, const Z_APDU *frontend_apdu, const BackendInstancePtr bp, Z_Records **z_records) { - Package search_package(bp->m_session, frontend_package.origin()); - - search_package.copy_filter(frontend_package); - mp::odr odr; Z_APDU *apdu_req = zget_APDU(odr, Z_APDU_searchRequest); Z_SearchRequest *req = apdu_req->u.searchRequest; @@ -689,7 +687,12 @@ restart: BackendSetPtr new_set(new BackendSet(result_set_id, databases, query)); Z_Records *z_records = 0; - if (!new_set->search(package, apdu_req, found_backend, &z_records)) + + Package search_package(found_backend->m_session, package.origin()); + search_package.copy_filter(package); + + if (!new_set->search(package, search_package, + apdu_req, found_backend, &z_records)) { bc->remove_backend(found_backend); return; // search error