After r900, I'm seeing a lot of valgrind errors with mapitest
I think the problem is that strcasestr() doesn't copy the string, so if we do
find the substring, then pdn is not NULL, but when we free tmp_dn, we can't
reasonably dereference pdn again.
Here is my attempt at it.
OK to commit?
Brad
--- libmapi/x500.c (revision 986)
+++ libmapi/x500.c (working copy)
@@ -38,8 +38,10 @@
tmp_dn = talloc_strdup(mem_ctx, dn);
pdn = strcasestr((const char *)tmp_dn, element);
- talloc_free(tmp_dn);
- if (pdn == NULL) return NULL;
+ if (pdn == NULL) {
+ talloc_free(tmp_dn);
+ return NULL;
+ }
pdn += strlen(element);
p = pdn;
@@ -49,7 +51,8 @@
}
str = talloc_strdup(mem_ctx, pdn);
-
+
+ talloc_free(tmp_dn);
return str;
}
_______________________________________________
devel mailing list
[email protected]
http://mailman.openchange.org/listinfo/devel