Comment #2 on issue 96 by tru64ufs: prefix structure memory leak
http://code.google.com/p/memcached/issues/detail?id=96

I think it is better not to include prefix statistics for keys without a prefix delimiter.

--- stats.c.orig        2009-10-12 14:14:21.000000000 +0900
+++ stats.c     2009-10-12 21:39:21.000000000 +0900
@@ -68,12 +68,18 @@
     PREFIX_STATS *pfs;
     uint32_t hashval;
     size_t length;
+    int bailout=1;

     assert(key != NULL);

     for (length = 0; key[length] != '\0' && length < nkey; length++)
-        if (key[length] == settings.prefix_delimiter)
+        if (key[length] == settings.prefix_delimiter) {
+            bailout=0;
             break;
+        }
+
+    if (bailout)
+      return NULL;

     hashval = hash(key, length, 0) % PREFIX_HASH_SIZE;



--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

Reply via email to