From 053c92d650501a953d68b228ad74d96b4606eaf6 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 10 Jan 2014 13:57:33 +0100 Subject: [PATCH] cookie: introduce yaz_cookies_reset --- include/yaz/cookie.h | 1 + src/cookie.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/yaz/cookie.h b/include/yaz/cookie.h index 8d83809..ed90f2e 100644 --- a/include/yaz/cookie.h +++ b/include/yaz/cookie.h @@ -47,6 +47,7 @@ YAZ_EXPORT void yaz_cookies_response(yaz_cookies_t yc, Z_HTTP_Response *res); YAZ_EXPORT void yaz_cookies_request(yaz_cookies_t yc, ODR odr, Z_HTTP_Request *req); +YAZ_EXPORT void yaz_cookies_reset(yaz_cookies_t yc); YAZ_END_CDECL diff --git a/src/cookie.c b/src/cookie.c index 2a22b2f..6aa0042 100644 --- a/src/cookie.c +++ b/src/cookie.c @@ -34,6 +34,12 @@ yaz_cookies_t yaz_cookies_create(void) void yaz_cookies_destroy(yaz_cookies_t yc) { + yaz_cookies_reset(yc); + xfree(yc); +} + +void yaz_cookies_reset(yaz_cookies_t yc) +{ if (yc) { struct cookie *c = yc->list; @@ -47,7 +53,7 @@ void yaz_cookies_destroy(yaz_cookies_t yc) xfree(c); c = c1; } - xfree(yc); + yc->list = 0; } } -- 1.7.10.4