pytest/segfault: segfault with nameless element
[ambi/samba-autobuild/.git] / python / samba / tests / segfault.py
index 38dcb5c703611deeaec37df574826fb10ef99b55..b95c1ef5fa9ec79b35b4c7784235d7ceb73f7355 100644 (file)
@@ -124,3 +124,13 @@ class SegfaultTests(samba.tests.TestCase):
             registry.open_ldb('', credentials=42)
         except ldb.LdbError as e:
             print("failed with %s" % e)
+
+    @segfault_detector
+    def test_ldb_add_nameless_element(self):
+        m = ldb.Message()
+        e = ldb.MessageElement('q')
+        try:
+            m.add(e)
+        except ldb.LdbError:
+            pass
+        str(m)