From 2f046b584d989e74918af8b1c20fd8a47af9784c Mon Sep 17 00:00:00 2001 From: datadiode Date: Sun, 25 Jan 2015 11:01:22 +0100 Subject: [PATCH] Fix a border case which causes Value::CommentInfo::setComment() to crash re: pull #140 --- src/lib_json/json_value.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index 1a1c763..150eff9 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -142,8 +142,10 @@ Value::CommentInfo::~CommentInfo() { } void Value::CommentInfo::setComment(const char* text) { - if (comment_) + if (comment_) { releaseStringValue(comment_); + comment_ = 0; + } JSON_ASSERT(text != 0); JSON_ASSERT_MESSAGE( text[0] == '\0' || text[0] == '/',