changeset 24624 | 6f0e6fa9fdd7 |
parent 24486 | 1a9efc312700 |
child 24651 | 67241ee427cf |
--- a/mercurial/dirs.c Mon Apr 06 08:23:27 2015 -0700 +++ b/mercurial/dirs.c Mon Apr 06 10:46:44 2015 -0700 @@ -93,11 +93,11 @@ if (ret == -1) goto bail; - if (pos != 0) - PyString_AS_STRING(key)[pos] = '/'; - else - key = NULL; - Py_CLEAR(key); + /* Clear the key out since we've already exposed it to Python + and can't mutate it further. key's refcount is currently 2 so + we can't just use Py_CLEAR. */ + Py_DECREF(key); + key = NULL; } ret = 0;