systemd/0001-dbus-common-avoid-leak-in-error-path.patch
Tomáš Chvátal fbd54ec893 Accepting request 203396 from Base:System
(please also push to 13.1, I want the same version as F20)
- Add
  0001-gpt-auto-generator-exit-immediately-if-in-container.patch:
  don't start gpt auto-generator in container (git).
- Add
  0001-manager-when-verifying-whether-clients-may-change-en.patch:
  fix reload check in selinux case (git).
- Add 0001-logind-fix-bus-introspection-data-for-TakeControl.patch:
  fix introspection for TakeControl (git).
- Add 0001-mount-check-for-NULL-before-reading-pm-what.patch: fix
  crash when parsing some incorrect unit (git).
- Add
  0001-shared-util-fix-off-by-one-error-in-tag_to_udev_node.patch:
  Fix udev rules parsing (git).
- Add
  0001-systemd-serialize-deserialize-forbid_restart-value.patch:
  Fix incorrect deserialization for forbid_restart (git).
- Add
  0001-core-unify-the-way-we-denote-serialization-attribute.patch:
  Ensure forbid_restart is named like other attributes (git).
- Add 0001-journald-fix-minor-memory-leak.patch: fix memleak in
  journald (git).
- Add
  0001-do-not-accept-garbage-from-acpi-firmware-performance.patch:
  Improve ACPI firmware performance parsing (git).
- Add
  0001-journald-remove-rotated-file-from-hashmap-when-rotat.patch:
  Fix journal rotation (git).
- Add
  0001-login-fix-invalid-free-in-sd_session_get_vt.patch:
  Fix memory corruption in sd_session_get_vt (git). (forwarded request 203387 from fcrozat)

OBS-URL: https://build.opensuse.org/request/show/203396
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=163
2013-10-17 12:28:29 +00:00

72 lines
2.1 KiB
Diff

From 74dcc2df7b2a340c3e1fe9e61e5c8deb324c83d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 11 Oct 2013 19:33:20 -0400
Subject: [PATCH] dbus-common: avoid leak in error path
src/shared/dbus-common.c:968:33: warning: Potential leak of memory pointed to by 'l'
return -EINVAL;
^~~~~~
---
src/shared/dbus-common.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/shared/dbus-common.c b/src/shared/dbus-common.c
index c727cae..3ba2d87 100644
--- a/src/shared/dbus-common.c
+++ b/src/shared/dbus-common.c
@@ -934,7 +934,7 @@ int bus_parse_strv_iter(DBusMessageIter *iter, char ***_l) {
int bus_parse_strv_pairs_iter(DBusMessageIter *iter, char ***_l) {
DBusMessageIter sub, sub2;
unsigned n = 0, i = 0;
- char **l;
+ _cleanup_strv_free_ char **l = NULL;
assert(iter);
assert(_l);
@@ -953,6 +953,7 @@ int bus_parse_strv_pairs_iter(DBusMessageIter *iter, char ***_l) {
l = new(char*, n*2+1);
if (!l)
return -ENOMEM;
+ l[0] = NULL; /* make sure that l is properly terminated at all times */
dbus_message_iter_recurse(iter, &sub);
@@ -968,26 +969,25 @@ int bus_parse_strv_pairs_iter(DBusMessageIter *iter, char ***_l) {
return -EINVAL;
l[i] = strdup(a);
- if (!l[i]) {
- strv_free(l);
+ if (!l[i])
return -ENOMEM;
- }
+ i++;
- l[++i] = strdup(b);
- if (!l[i]) {
- strv_free(l);
+ l[i] = strdup(b);
+ if (!l[i])
return -ENOMEM;
- }
-
i++;
+
dbus_message_iter_next(&sub);
}
assert(i == n*2);
l[i] = NULL;
- if (_l)
+ if (_l) {
*_l = l;
+ l = NULL; /* avoid freeing */
+ }
return 0;
}
--
1.8.4