]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: add doc to clear-up hash_iterate multi deletion
authorStephen Worley <sworley@cumulusnetworks.com>
Tue, 1 Sep 2020 20:02:12 +0000 (16:02 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Mon, 28 Sep 2020 16:41:00 +0000 (12:41 -0400)
Add some header documentation to make it clear that you
cannot delete more than one item during each iteration.
Doing so could cause memory corruption for next pointer
if its also deleted from the table.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
lib/hash.h

index e7ba3187f585e9b33b293531b9b1993f10d926ff..00953ff3b326c15158be06168316f45d00c93dd5 100644 (file)
@@ -236,7 +236,8 @@ extern void *hash_release(struct hash *hash, void *data);
  * Iterate over the elements in a hash table.
  *
  * It is safe to delete items passed to the iteration function from the hash
- * table during iteration.  Please note that adding entries to the hash
+ * table during iteration. More than one item cannot be deleted during each
+ * iteration. Please note that adding entries to the hash
  * during the walk will cause undefined behavior in that some new entries
  * will be walked and some will not.  So do not do this.
  *