summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-message.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-30 19:45:32 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-30 19:47:46 +0100
commit79f8d3d2ce51e992493f2d354a5764262c9d564a (patch)
treeea3b33286bed0f01d9f390def4d02b281b178247 /src/libsystemd-bus/bus-message.c
parentb57bdedc87c763aba1b5e8dc5396bfa3ac7d5086 (diff)
bus: support temporarily const errors that don't need to be freed but require deep copies
This should fix issues with incorrectly copying bus error messages out of sd_bus_message objects. Original bug found by: Djalal Harouni
Diffstat (limited to 'src/libsystemd-bus/bus-message.c')
-rw-r--r--src/libsystemd-bus/bus-message.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 639b9a6214..a1e6c9f973 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -609,6 +609,8 @@ _public_ int sd_bus_message_new_method_error(
goto fail;
}
+ t->error._need_free = -1;
+
*m = t;
return 0;
@@ -709,6 +711,8 @@ int bus_message_new_synthetic_error(
goto fail;
}
+ t->error._need_free = -1;
+
*m = t;
return 0;
@@ -3804,6 +3808,9 @@ int bus_message_parse_fields(sd_bus_message *m) {
return -EBADMSG;
r = message_peek_field_string(m, error_name_is_valid, &ri, &m->error.name);
+ if (r >= 0)
+ m->error._need_free = -1;
+
break;
case SD_BUS_MESSAGE_HEADER_DESTINATION: