Author: idra
Date: 2006-02-06 00:39:05 +0000 (Mon, 06 Feb 2006)
New Revision: 13360

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13360

Log:

Fix crash bug when 0 results are returned on the internal base search


Modified:
   branches/SAMBA_4_0/source/lib/ldb/modules/asq.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/modules/asq.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/modules/asq.c     2006-02-06 00:27:02 UTC 
(rev 13359)
+++ branches/SAMBA_4_0/source/lib/ldb/modules/asq.c     2006-02-06 00:39:05 UTC 
(rev 13360)
@@ -126,14 +126,22 @@
 
        ret = ldb_request(module->ldb, base_req);
 
-       if (ret != LDB_SUCCESS)
+       if (ret != LDB_SUCCESS) {
+               talloc_free(base_req);
                return ret;
+       }
 
+       if (base_req->op.search.res->count == 0) {
+               talloc_free(base_req);
+               return build_response(res, ASQ_CTRL_SUCCESS);
+       }
+       
        /* look up the DNs */
        el = ldb_msg_find_element(base_req->op.search.res->msgs[0],
                                  asq_ctrl->source_attribute);
        /* no values found */
        if (el == NULL) {
+               talloc_free(base_req);
                return build_response(res, ASQ_CTRL_SUCCESS);
        }
 
@@ -181,6 +189,8 @@
                talloc_free(exp_req);
        }
 
+       talloc_free(base_req);
+
        return build_response(res, ASQ_CTRL_SUCCESS);
 }
 

Reply via email to