Bug 33128 - integrate remaining cleanup patches from Maemo
Summary: integrate remaining cleanup patches from Maemo
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: 1.4.x
Hardware: Other All
: medium normal
Assignee: Simon McVittie
QA Contact: John (J5) Palmieri
URL:
Whiteboard: NB#211818
Keywords: patch
Depends on:
Blocks: dbus-1.5
  Show dependency treegraph
 
Reported: 2011-01-14 10:17 UTC by Simon McVittie
Modified: 2011-05-25 08:12 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
free more stuff in dbus-cleanup-sockets (1015 bytes, patch)
2011-01-14 10:21 UTC, Simon McVittie
Details | Splinter Review
handle OOM in nonce authentication (864 bytes, patch)
2011-01-14 10:22 UTC, Simon McVittie
Details | Splinter Review
handle failure to register inotify shutdown function (558 bytes, patch)
2011-01-14 10:23 UTC, Simon McVittie
Details | Splinter Review
Free things in update_desktop_file_entry() (686 bytes, patch)
2011-01-14 10:25 UTC, Simon McVittie
Details | Splinter Review
free matchmaker itself if bus_matchmaker_new fails (281 bytes, patch)
2011-01-14 10:27 UTC, Simon McVittie
Details | Splinter Review
clean up nonce file more reliably in _dbus_server_new_for_tcp_socket (2.03 KB, patch)
2011-01-14 10:28 UTC, Simon McVittie
Details | Splinter Review
remove obviously-redundant code from list_concat_new (366 bytes, patch)
2011-01-14 10:29 UTC, Simon McVittie
Details | Splinter Review
Clean up credentials on OOM in process_config_first_time_only (868 bytes, patch)
2011-01-14 10:30 UTC, Simon McVittie
Details | Splinter Review
test_server_setup: clean up server data (319 bytes, patch)
2011-01-14 10:31 UTC, Simon McVittie
Details | Splinter Review
replace unreachable code with an assertion (550 bytes, patch)
2011-01-14 10:32 UTC, Simon McVittie
Details | Splinter Review
dbus-send: turn unreachable code into an assertion (488 bytes, patch)
2011-01-14 10:32 UTC, Simon McVittie
Details | Splinter Review
[review-] writer_recurse_array: add an assertion (539 bytes, patch)
2011-01-14 10:33 UTC, Simon McVittie
Details | Splinter Review
dbus_connection_dispatch: remove dead code (1.14 KB, patch)
2011-01-26 10:42 UTC, Simon McVittie
Details | Splinter Review
dbus-send: remove minor dead code (793 bytes, patch)
2011-01-26 10:43 UTC, Simon McVittie
Details | Splinter Review

Description Simon McVittie 2011-01-14 10:17:36 UTC
Maemo's dbus package at http://gitorious.org/gnome-essentials/dbus has an assortment of patches named debian/patches/CID-<something>.patch, which clean up memory leaks and other misc issues.

Some of them are on Bug #29881 already; some are uncontroversial and can be applied; some don't look correct to me.
Comment 1 Simon McVittie 2011-01-14 10:21:53 UTC
Created attachment 42049 [details] [review]
free more stuff in dbus-cleanup-sockets

Doesn't look very important, since it's in an ancillary tool. Not reviewed.
Comment 2 Simon McVittie 2011-01-14 10:22:35 UTC
Created attachment 42050 [details] [review]
handle OOM in nonce authentication

Looks right at first glance, but not reviewed in detail yet.
Comment 3 Simon McVittie 2011-01-14 10:23:32 UTC
Created attachment 42051 [details] [review]
handle failure to register inotify shutdown function

Looks OK at first glance, although more cleanup/unwinding might be required.
Comment 4 Simon McVittie 2011-01-14 10:25:48 UTC
Created attachment 42053 [details] [review]
Free things in update_desktop_file_entry()

I think this can sometimes double-free exec?

Similar to one of my patches on Bug #33126.
Comment 5 Simon McVittie 2011-01-14 10:27:05 UTC
Created attachment 42054 [details] [review]
free matchmaker itself if bus_matchmaker_new fails

Looks OK at first glance.
Comment 6 Simon McVittie 2011-01-14 10:28:27 UTC
Created attachment 42055 [details] [review]
clean up nonce file more reliably in _dbus_server_new_for_tcp_socket

I can't immediately see anything wrong but 4 unwinding labels is a bit much. Perhaps this could be refactored.
Comment 7 Simon McVittie 2011-01-14 10:29:15 UTC
Created attachment 42056 [details] [review]
remove obviously-redundant code from list_concat_new

Looks good to me.
Comment 8 Simon McVittie 2011-01-14 10:30:12 UTC
Created attachment 42057 [details] [review]
Clean up credentials on OOM in process_config_first_time_only

I would hope that we could move the _dbus_credentials_unref call to below the oom label rather than duplicating it.
Comment 9 Simon McVittie 2011-01-14 10:31:29 UTC
Created attachment 42058 [details] [review]
test_server_setup: clean up server data
Comment 10 Simon McVittie 2011-01-14 10:32:12 UTC
Created attachment 42059 [details] [review]
replace unreachable code with an assertion

I haven't verified that this is actually unreachable...
Comment 11 Simon McVittie 2011-01-14 10:32:48 UTC
Created attachment 42060 [details] [review]
dbus-send: turn unreachable code into an assertion

Again, I haven't verified that this is unreachable.
Comment 12 Simon McVittie 2011-01-14 10:33:30 UTC
Created attachment 42061 [details] [review]
[review-] writer_recurse_array: add an assertion

Not sure what this is for; it's probably to shut Coverity up, more than anything else.
Comment 13 Simon McVittie 2011-01-17 03:56:10 UTC
Review of attachment 42050 [details] [review]:

Committed.
Comment 14 Simon McVittie 2011-01-17 03:58:48 UTC
Review of attachment 42054 [details] [review]:

Committed.
Comment 15 Simon McVittie 2011-01-17 04:02:58 UTC
Review of attachment 42051 [details] [review]:

Committed.
Comment 16 Simon McVittie 2011-01-17 04:04:26 UTC
Review of attachment 42056 [details] [review]:

Committed
Comment 17 Simon McVittie 2011-01-17 04:18:47 UTC
Review of attachment 42049 [details] [review]:

This isn't really important - dbus-cleanup-sockets should terminate rapidly, at which point memory leaks become entirely academic - but the patch looks fine so we might as well have it.

Committed.
Comment 18 Simon McVittie 2011-01-17 04:22:58 UTC
Review of attachment 42058 [details] [review]:

::: test/test-utils.c
@@ -320,3 @@
  nomem:
-  if (sd)
-    serverdata_free (sd);

I'm guessing this was probably intended to fix a Coverity warning about unreachable code? It's the wrong fix: the bug here is that if we fail to set the watch/timeout functions, we return directly (without freeing @sd) instead of jumping to nomem to clean up.

Rejected; I'll write a patch for the correct version.
Comment 19 Simon McVittie 2011-01-18 09:40:22 UTC
Comment on attachment 42053 [details] [review]
Free things in update_desktop_file_entry()

Obsoleted by patches 2/7 to 6/7 on Bug #33126.
Comment 20 Simon McVittie 2011-01-26 10:42:40 UTC
Created attachment 42543 [details] [review]
dbus_connection_dispatch: remove dead code

There's no way pending can be non-NULL here; if it was, we'd have jumped
straight past this block (getting filters from the connection), because
replies to pending calls don't go through filters.

(This patch isn't particularly important, but it makes our library fractionally smaller, removes dead code that might confuse someone, and makes code analyzers shut up.)
Comment 21 Simon McVittie 2011-01-26 10:43:32 UTC
Created attachment 42544 [details] [review]
dbus-send: remove minor dead code

This version is more self-explaining and has fewer lines. :-)
Comment 22 Simon McVittie 2011-01-26 10:46:13 UTC
Review of attachment 42061 [details] [review]:

It's not at all clear to me that this is correct. Either it's papering over a real bug, or there are a lot of redundant checks; analysis needed.
Comment 23 Simon McVittie 2011-01-26 10:54:36 UTC
Review of attachment 42055 [details] [review]:

This one does look correct, although it could probably be clearer. Applied.
Comment 24 Simon McVittie 2011-02-03 04:04:42 UTC
The remaining non-obsoleted attachments are good to go, I think. I rewrote them, so review from someone else is required.
Comment 25 Cosimo Alfarano 2011-02-28 10:30:14 UTC
well, my less-than-1p, since the patches are really simple :)

but they look fine to me, without any developer hat on my head.
Comment 26 Simon McVittie 2011-05-25 08:12:11 UTC
Fixed in git for 1.4.10 (R-b: Cosimo), will be merged to master for 1.5.2


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.