coverity: Model GLib string allocation partially
authorMarkus Armbruster <armbru@redhat.com>
Mon, 26 Jan 2015 14:05:11 +0000 (15:05 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 5 Feb 2015 16:16:07 +0000 (17:16 +0100)
commite4b77daa5724a9dd41aaa44d2dea4b8e92351081
tree400f986980cddbe191501de75d426e98ce373cfa
parent9d7a4c6690ef9962a3b20034f65008f1ea15c1d6
coverity: Model GLib string allocation partially

Without a model, Coverity can't know that the result of g_strdup()
needs to be fed to g_free().

One way to get such a model is to scan GLib, build a derived model
file with cov-collect-models, and use that when scanning QEMU.
Unfortunately, the Coverity Scan service we use doesn't support that.

Thus, we're stuck with the other way: write a user model.  Doing that
for all of GLib is hardly practical.  I'm doing it for the "String
Utility Functions" we actually use that return dynamically allocated
strings.

In a local scan, this flags 20 additional RESOURCE_LEAKs.  The ones I
checked look genuine.

It also loses a NULL_RETURNS about ppce500_init() using
qemu_find_file() without error checking.  I don't understand why.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
scripts/coverity-model.c