xenstore: add assertion in database dumping code
authorWei Liu <wei.liu2@citrix.com>
Wed, 20 Jul 2016 14:13:42 +0000 (15:13 +0100)
committerWei Liu <wei.liu2@citrix.com>
Wed, 20 Jul 2016 15:09:25 +0000 (16:09 +0100)
If memfile is NULL, the signal handler won't be installed, hence fopen
won't dereference NULL. Coverity is not smart enough to figure that out
unfortunately.

Add an assertion to prevent coverity from complaining.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/xenstore/xenstored_core.c

index 5b2a49bd8459934797fac3593700116e3ba1d714..693d47d4d10e59ec564dd95b15ee8a73fe76cf0a 100644 (file)
@@ -2135,6 +2135,7 @@ int main(int argc, char *argv[])
                if (trigger_talloc_report) {
                        FILE *out;
 
+                       assert(memfile);
                        trigger_talloc_report = false;
                        out = fopen(memfile, "a");
                        if (out) {