Module: sip-router
Branch: 3.3
Commit: 890f785bc05f137af624306f51874c17bef10d30
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=890f785…
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
(cherry picked from commit 22f9a675863f85d934afa5e7c09061c66497042b)
---
pvapi.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/pvapi.c b/pvapi.c
index d1ebfe6..64878f2 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;