From 95441712331a674e814d217f197033d2e06af838 Mon Sep 17 00:00:00 2001 From: Xiaoqiang Wang Date: Sat, 19 Feb 2022 20:49:09 +0100 Subject: [PATCH] avoid dangling pointer when indexvalue does out of scope --- src/ca/dbdToPv.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ca/dbdToPv.cpp b/src/ca/dbdToPv.cpp index f78876df..ffbe1217 100644 --- a/src/ca/dbdToPv.cpp +++ b/src/ca/dbdToPv.cpp @@ -840,6 +840,7 @@ Status DbdToPv::putToDBD( char *ca_stringBuffer(0); dbr_char_t bvalue(0); dbr_short_t svalue(0); + dbr_enum_t evalue(0); dbr_long_t lvalue(0); dbr_float_t fvalue(0); dbr_double_t dvalue(0); @@ -944,8 +945,7 @@ Status DbdToPv::putToDBD( case DBR_ENUM: { GET_SUBFIELD_WITH_ERROR_CHECK(PVInt, pvValue, pvStructure, "value.index", "DbdToPv::putToDBD logic error"); - dbr_enum_t indexvalue = pvValue->get(); - pValue = &indexvalue; + pValue = put_DBRScalar(&evalue,pvValue); break; } case DBR_STRING: