svn commit: samba r7759 - in
branches/SAMBA_4_0/source/lib/ldb/common: .
derrell at samba.org
derrell at samba.org
Tue Jun 21 17:11:32 GMT 2005
tridge at samba.org writes:
> Author: tridge
> Date: 2005-06-19 13:29:07 +0000 (Sun, 19 Jun 2005)
> New Revision: 7759
>
> WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7759
>
> Log:
> allow ldb_errstring() to be used when not connected
>
>
> Modified:
> branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
>
>
> Changeset:
> Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
> ===================================================================
> --- branches/SAMBA_4_0/source/lib/ldb/common/ldb.c 2005-06-19 13:27:22 UTC (rev 7758)
> +++ branches/SAMBA_4_0/source/lib/ldb/common/ldb.c 2005-06-19 13:29:07 UTC (rev 7759)
> @@ -172,6 +172,9 @@
> */
> const char *ldb_errstring(struct ldb_context *ldb)
> {
> + if (ldb->modules == NULL) {
> + return "ldb not connected";
> + }
> return ldb->modules->ops->errstring(ldb->modules);
> }
>
Shouldn't this be talloc_strdup("ldb not connected")? The error string from
some modules is likely to have to be allocated, as it may be coming,
initially, from an external library which malloc()s it, so the string will
have to be talloc_strdup()ed to be returned. (e.g. sqlite).
Derrell
More information about the samba-technical
mailing list