After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 719533 - Clang static analysis fixes
Clang static analysis fixes
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: general
3.11.x (obsolete)
Other All
: Normal normal
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2013-11-29 09:05 UTC by Philip Withnall
Modified: 2013-12-04 01:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
camel: Fix a potential g_object_unref(NULL) call (1.42 KB, patch)
2013-11-29 09:05 UTC, Philip Withnall
committed Details | Review
libedata-book: Remove an unnecessary NULL check on an EContact (1.26 KB, patch)
2013-11-29 09:05 UTC, Philip Withnall
committed Details | Review
libedata-book: Fix a potential g_object_unref(NULL) call (962 bytes, patch)
2013-11-29 09:05 UTC, Philip Withnall
reviewed Details | Review
libecal: Refactor system timezone key file parsing code (1.56 KB, patch)
2013-11-29 09:06 UTC, Philip Withnall
committed Details | Review
libedata-cal: Fix a potential g_strstrip(NULL) call (1.46 KB, patch)
2013-11-29 09:06 UTC, Philip Withnall
committed Details | Review
tests: Fix potential g_object_unref(NULL) calls in libebook tests (1.53 KB, patch)
2013-11-29 09:06 UTC, Philip Withnall
committed Details | Review

Description Philip Withnall 2013-11-29 09:05:44 UTC
A couple of patches fixing some bugs where a NULL pointer is potentially used when an object or string was expected.

These were found by scan-build (http://www.murrayc.com/permalink/2013/11/15/jhbuild-and-clangs-scan-build/) with some GLib patches to mark functions as not accepting NULL arguments (bug #113075).
Comment 1 Philip Withnall 2013-11-29 09:05:47 UTC
Created attachment 263092 [details] [review]
camel: Fix a potential g_object_unref(NULL) call

If all the branch conditions in this function evaluate to FALSE, the
stream is never set, and hence g_object_unref(NULL) is called on exiting
the function.

Found by scan-build.
Comment 2 Philip Withnall 2013-11-29 09:05:50 UTC
Created attachment 263093 [details] [review]
libedata-book: Remove an unnecessary NULL check on an EContact

A newly-created EContact is never NULL, so the check is redundant. It
was confusing the static analyser.
Comment 3 Philip Withnall 2013-11-29 09:05:57 UTC
Created attachment 263094 [details] [review]
libedata-book: Fix a potential g_object_unref(NULL) call

backend is checked for being NULL just above it.

Found by scan-build.
Comment 4 Philip Withnall 2013-11-29 09:06:04 UTC
Created attachment 263095 [details] [review]
libecal: Refactor system timezone key file parsing code

Previously, the code could call g_strstrip(NULL) if a line started with
a quotation mark but didn’t end with one, e.g.:
    MyKey="some-unbalanced-value

The code now ignores unbalanced quotation marks, returning the odd one
in the value rather than crashing (or stripping it).

Found by scan-build.
Comment 5 Philip Withnall 2013-11-29 09:06:14 UTC
Created attachment 263096 [details] [review]
libedata-cal: Fix a potential g_strstrip(NULL) call

If the calendar contained any attendees _not_ prefixed with ‘mailto:’,
the text variable would be NULL, and would cause an assertion failure in
g_strstrip().

Found by scan-build.
Comment 6 Philip Withnall 2013-11-29 09:06:24 UTC
Created attachment 263097 [details] [review]
tests: Fix potential g_object_unref(NULL) calls in libebook tests

Found by scan-build.
Comment 7 Matthew Barnes 2013-12-03 20:13:17 UTC
Thanks for all the patches.  I'm reviewing and committing them individually.
Comment 8 Matthew Barnes 2013-12-03 20:15:02 UTC
Review of attachment 263093 [details] [review]:

This is technically correct, but I love how the API makes no allowance for parsing errors.  :/

Don't suppose that would be in scope for your EVCard rework?
Comment 9 Matthew Barnes 2013-12-03 20:29:57 UTC
Review of attachment 263094 [details] [review]:

This one looks obsolete now in light of Tristan's recent locale work.