Created
October 13, 2013 08:55
-
-
Save sergej/6959996 to your computer and use it in GitHub Desktop.
Fix sm crash on HUP signal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/sm/sm.c b/sm/sm.c | |
index d48541e..2dcf25e 100644 | |
--- a/sm/sm.c | |
+++ b/sm/sm.c | |
@@ -329,7 +329,7 @@ int sm_register_ns(sm_t sm, const char *uri) { | |
ns_idx = xhash_count(sm->xmlns) + 2; | |
xhash_put(sm->xmlns, pstrdup(xhash_pool(sm->xmlns), uri), (void *) (long) ns_idx); | |
} | |
- xhash_put(sm->xmlns_refcount, uri, (void *) ((long) xhash_get(sm->xmlns_refcount, uri) + 1)); | |
+ xhash_put(sm->xmlns_refcount, pstrdup(xhash_pool(sm->xmlns_refcount), uri), (void *) ((long) xhash_get(sm->xmlns_refcount, uri) + 1)); | |
return ns_idx; | |
} | |
@@ -341,7 +341,7 @@ void sm_unregister_ns(sm_t sm, const char *uri) { | |
xhash_zap(sm->xmlns, uri); | |
xhash_zap(sm->xmlns_refcount, uri); | |
} else if (refcount > 1) { | |
- xhash_put(sm->xmlns_refcount, uri, (void *) ((long) xhash_get(sm->xmlns_refcount, uri) - 1)); | |
+ xhash_put(sm->xmlns_refcount, pstrdup(xhash_pool(sm->xmlns_refcount), uri), (void *) ((long) xhash_get(sm->xmlns_refcount, uri) - 1)); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment