summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2019-01-02 18:42:19 +0530
committerAmar Tumballi <amarts@redhat.com>2019-01-07 03:17:49 +0000
commit4a15ea1fd36390fa247dc2e429f14dc8fd621c49 (patch)
tree8db13f85274f90351507c86a027a6892f0593f36 /rpc
parent95ec7391d8db26b933e542694add2b419dddf89f (diff)
rpcsvc: Don't expect dictionary values to be available
When reconfigure happens, string values from one dictionary are directly set in another dictionary. This can lead to invalid memory when the first dictionary is freed up. So do dict_set_dynstr_with_alloc instead of dict_set_str updates bz#1650403 Change-Id: Id53236467521cfdeb07e7178d87ba6cf88d17003 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index c057b6f3cb9..74373c44f91 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -2563,7 +2563,7 @@ rpcsvc_reconfigure_options(rpcsvc_t *svc, dict_t *options)
*/
dict_del(svc->options, srchkey);
if (!dict_get_str(options, srchkey, &keyval)) {
- ret = dict_set_str(svc->options, srchkey, keyval);
+ ret = dict_set_dynstr_with_alloc(svc->options, srchkey, keyval);
if (ret < 0) {
gf_log(GF_RPCSVC, GF_LOG_ERROR, "dict_set_str error");
GF_FREE(srchkey);
@@ -2595,7 +2595,7 @@ rpcsvc_reconfigure_options(rpcsvc_t *svc, dict_t *options)
*/
dict_del(svc->options, srchkey);
if (!dict_get_str(options, srchkey, &keyval)) {
- ret = dict_set_str(svc->options, srchkey, keyval);
+ ret = dict_set_dynstr_with_alloc(svc->options, srchkey, keyval);
if (ret < 0) {
gf_log(GF_RPCSVC, GF_LOG_ERROR, "dict_set_str error");
GF_FREE(srchkey);