diff --git a/include/asterisk/message.h b/include/asterisk/message.h
index e52c4c406093078242d53f5c4c416d6e9e25d148..d989563e5628ebd4304cb8d1ceed5ec4a2646280 100644
--- a/include/asterisk/message.h
+++ b/include/asterisk/message.h
@@ -173,7 +173,8 @@ int ast_msg_set_var(struct ast_msg *msg, const char *name, const char *value);
 /*!
  * \brief Get the specified variable on the message
  * \note The return value is valid only as long as the ast_message is valid. Hold a reference
- *       to the message if you plan on storing the return value. 
+ *       to the message if you plan on storing the return value. Do re-set the same
+ *       message var name while holding a pointer to the result of this function.
  *
  * \return The value associated with variable "name". NULL if variable not found.
  */
diff --git a/main/message.c b/main/message.c
index f2c5f4ddb517c437b8ac4c93cab4ad08dbcc5e99..edc54c8ea66ea950fe6b5e9f762459821991fd31 100644
--- a/main/message.c
+++ b/main/message.c
@@ -522,12 +522,20 @@ int ast_msg_set_var(struct ast_msg *msg, const char *name, const char *value)
 const char *ast_msg_get_var(struct ast_msg *msg, const char *name)
 {
 	struct msg_data *data;
+	const char *val = NULL;
 
 	if (!(data = msg_data_find(msg->vars, name))) {
 		return NULL;
 	}
 
-	return data->value;
+	/* Yep, this definitely looks like val would be a dangling pointer
+	 * after the ref count is decremented.  As long as the message structure
+	 * is used in a thread safe manner, this will not be the case though.
+	 * The ast_msg holds a reference to this object in the msg->vars container. */
+	val = data->value;
+	ao2_ref(data, -1);
+
+	return val;
 }
 
 struct ast_msg_var_iterator {