GNOME Bugzilla – Bug 719533
Clang static analysis fixes
Last modified: 2013-12-04 01:33:11 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).
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.
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.
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.
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.
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.
Created attachment 263097 [details] [review] tests: Fix potential g_object_unref(NULL) calls in libebook tests Found by scan-build.
Thanks for all the patches. I'm reviewing and committing them individually.
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?
Review of attachment 263094 [details] [review]: This one looks obsolete now in light of Tristan's recent locale work.
The patch in comment 3 didn't apply to the gnome-3-10 branch either, but the rest did. Patches committed for E-D-S 3.11.3: https://git.gnome.org/browse/evolution-data-server/commit/?id=1161f3fbc1f6018fbc163b2f3078c5938f983c19 https://git.gnome.org/browse/evolution-data-server/commit/?id=047c4470a554c6f4e9a5a83b414d2d65ef759436 https://git.gnome.org/browse/evolution-data-server/commit/?id=f851d77bcec88d4a2e664185ba760f9cfd08ee1f https://git.gnome.org/browse/evolution-data-server/commit/?id=3304de4e2db1be25fb40a413e824b6c0f44069a9 https://git.gnome.org/browse/evolution-data-server/commit/?id=fcccd30fb3d34feb2b040bade6c0595314e4e4e5 and E-D-S 3.10.3: https://git.gnome.org/browse/evolution-data-server/commit/?h=gnome-3-10&id=3df0d7608cb03375ae8bf365807bb64844e30c7c https://git.gnome.org/browse/evolution-data-server/commit/?h=gnome-3-10&id=f7b21d07f5bdc3a40979c89d75ffc40c13abeca2 https://git.gnome.org/browse/evolution-data-server/commit/?h=gnome-3-10&id=ecb7975072af5d6da6975e8aef5427cbef68f61c https://git.gnome.org/browse/evolution-data-server/commit/?h=gnome-3-10&id=6fdf53e84fb90f8e3a929d123d1eb733757ddbbb https://git.gnome.org/browse/evolution-data-server/commit/?h=gnome-3-10&id=3ac44881c3de3dc62e712eb353283c0c98840fe7