Minor adjustments
[yaz-moved-to-github.git] / server / seshigh.c
index 294651c..3ebb06f 100644 (file)
@@ -4,7 +4,13 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: seshigh.c,v $
- * Revision 1.50  1995-10-25 16:58:32  quinn
+ * Revision 1.53  1995-11-01 13:54:58  quinn
+ * Minor adjustments
+ *
+ * Revision 1.52  1995/11/01  12:19:13  quinn
+ * Second attempt to fix same bug.
+ *
+ * Revision 1.50  1995/10/25  16:58:32  quinn
  * Simple.
  *
  * Revision 1.49  1995/10/16  13:51:53  quinn
 #include <assert.h>
 #include <sys/time.h>
 
-#include <dmalloc.h>
+#include <xmalloc.h>
 #include <comstack.h>
 #include <eventl.h>
 #include <session.h>
@@ -232,7 +238,7 @@ association *create_association(IOCHAN channel, COMSTACK link)
 
     if (!control_block)
        control_block = statserv_getcontrol();
-    if (!(new = malloc(sizeof(*new))))
+    if (!(new = xmalloc(sizeof(*new))))
        return 0;
     new->client_chan = channel;
     new->client_link = link;
@@ -298,12 +304,12 @@ void destroy_association(association *h)
     if (h->print)
        odr_destroy(h->print);
     if (h->input_buffer)
-       free(h->input_buffer);
+    xfree(h->input_buffer);
     if (h->backend)
        bend_close(h->backend);
     while (request_deq(&h->incoming));
     while (request_deq(&h->outgoing));
-    free(h);
+   xfree(h);
 }
 
 static void do_close(association *a, int reason, char *message)
@@ -567,7 +573,7 @@ static int process_response(association *assoc, request *req, Z_APDU *res)
     }
     req->response = odr_getbuf(assoc->encode, &req->len_response,
        &req->size_response);
-    odr_setbuf(assoc->encode, 0, 0, 0); /* don't free if we abort later */
+    odr_setbuf(assoc->encode, 0, 0, 0); /* don'txfree if we abort later */
     odr_reset(assoc->encode);
     if (assoc->print && !z_APDU(assoc->print, &res, 0))
     {
@@ -1044,7 +1050,7 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb,
     else
     {
        static int toget;
-       Z_RecordComposition comp;
+       Z_RecordComposition comp, *compp = 0;
        static int presst = 0;
 
        resp.records = 0;
@@ -1055,14 +1061,16 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb,
        if (bsrt->hits <= *req->smallSetUpperBound)
        {
            toget = bsrt->hits;
-           comp.u.simple = req->smallSetElementSetNames;
+           if ((comp.u.simple = req->smallSetElementSetNames))
+               compp = &comp;
        }
        else if (bsrt->hits < *req->largeSetLowerBound)
        {
            toget = *req->mediumSetPresentNumber;
            if (toget > bsrt->hits)
                toget = bsrt->hits;
-           comp.u.simple = req->mediumSetElementSetNames;
+           if ((comp.u.simple = req->mediumSetElementSetNames))
+               compp = &comp;
        }
        else
            toget = 0;
@@ -1078,7 +1086,7 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb,
            else
                form = prefformat->value;
            resp.records = pack_records(assoc, req->resultSetName, 1,
-               &toget, &comp, &next, &presst, form);
+               &toget, compp, &next, &presst, form);
            if (!resp.records)
                return 0;
            resp.numberOfRecordsReturned = &toget;