Module: sip-router
Branch: master
Commit: 22f9a675863f85d934afa5e7c09061c66497042b
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=22f9a67…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Oct 25 09:25:17 2012 +0200
core: use cloned value to parse pv name for caching
- patch by Hugh Waite
---
pvapi.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/pvapi.c b/pvapi.c
index 209d835..b438362 100644
--- a/pvapi.c
+++ b/pvapi.c
@@ -272,17 +272,17 @@ pv_spec_t* pv_cache_add(str *name)
LM_ERR("no more memory\n");
return NULL;
}
- memset(pvn, 0, sizeof(pv_item_t) + name->len + 1);
- p = pv_parse_spec(name, &pvn->spec);
+ memset(pvn, 0, sizeof(pv_cache_t) + name->len + 1);
+ pvn->pvname.len = name->len;
+ pvn->pvname.s = (char*)pvn + sizeof(pv_cache_t);
+ memcpy(pvn->pvname.s, name->s, name->len);
+ p = pv_parse_spec(&pvn->pvname, &pvn->spec);
if(p==NULL)
{
pkg_free(pvn);
return NULL;
}
- pvn->pvname.len = name->len;
- pvn->pvname.s = (char*)pvn + sizeof(pv_cache_t);
- memcpy(pvn->pvname.s, name->s, name->len);
pvn->pvid = pvid;
pvn->next = _pv_cache[pvid%PV_CACHE_SIZE];
_pv_cache[pvid%PV_CACHE_SIZE] = pvn;