projects
/
metaproxy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util: Fix leak in uri_encode. Add uri_decode
[metaproxy-moved-to-github.git]
/
src
/
util.cpp
diff --git
a/src/util.cpp
b/src/util.cpp
index
1f335a1
..
4265682
100644
(file)
--- a/
src/util.cpp
+++ b/
src/util.cpp
@@
-690,9
+690,21
@@
std::string mp_util::uri_encode(std::string s)
char *x = (char *) xmalloc(1 + s.length() * 3);
yaz_encode_uri_component(x, s.c_str());
std::string result(x);
char *x = (char *) xmalloc(1 + s.length() * 3);
yaz_encode_uri_component(x, s.c_str());
std::string result(x);
+ xfree(x);
return result;
}
return result;
}
+
+std::string mp_util::uri_decode(std::string s)
+{
+ char *x = (char *) xmalloc(1 + s.length());
+ yaz_decode_uri_component(x, s.c_str(), s.length());
+ std::string result(x);
+ xfree(x);
+ return result;
+}
+
+
/*
* Local variables:
* c-basic-offset: 4
/*
* Local variables:
* c-basic-offset: 4