Commit graph

8 commits

Author SHA1 Message Date
Ravi Nanjundappa
c6ae5b1976 test: Fix null pointer issue reported by cppcheck static analysis tool
cppcheck analysis tool reports the following issues when run on the
latest Cairo source.

$ grep "(error)"  cppcheck_error_log.txt
[test/pdf-mime-data.c:58]: (error) Possible null pointer dereference: file - otherwise it is redundant to check if file is null at line 53
[test/pdf-mime-data.c:75]: (error) Resource leak: fp
$

The proposed changes fixes the above issues.

And also it does some refactoring to print the appropriate error messages
for each error condition in read_file() function and also to free the allocated
data buffer.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-27 20:39:57 -07:00
Sylvestre Ledru
247cfaaa25 Fix some memory leaks found by scan-build, the LLVM/Clang static analyzer
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
2014-05-16 11:11:34 -07:00
Bryce W. Harrington
f9dcd07d22 test: Ensure output dirs exist, falling back to current dir if needed
This change makes several tests behave more like ps-eps.c, et al by
making them attempt to mkdir "output", and in case of trouble use "."
instead.  filenames are now allocated at runtime due to this change, so
ensure the corresponding free()'s are in place as well.

This should facilitate running the test suite with a relative path
outside cairo's source tree, such as when employing the CAIRO_REF_DIR
environment variable.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-09 21:25:12 +02:00
Bryce W. Harrington
6731023f1b test: Fix several tests to place output files in the output directory
The standard location for test output is cairo/test/output.  The harness
itself was updated to write automatically generated images in this
directory, however a number of tests generate their own local output
files.

This patch updates these tests to write their output into
CAIRO_TEST_OUTPUT_DIR (which defaults to cairo/test/output) as well, in
the interest of decluttering the test directory.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-09 21:15:50 +02:00
Chris Wilson
dd65be740c [test/pdf-mime-data] Free data on error paths.
Cleanup the allocated buffers on error.
2009-01-02 15:44:51 +00:00
Chris Wilson
2554d17598 [surface] Pass a separate closure for the mime-type destroy notifier.
A limitation of the current API was that the destroy notifier was called
on the mime-data block. This prevents the user from passing in a pointer
to a managed block, for example a mime-data block belonging to a
ref-counted object. We can overcome this by allowing the user to specify
the closure to be used with the destroy notifier.
2008-11-07 19:30:33 +00:00
Chris Wilson
8407470409 [test] Adapt pdf-mime-data for non-srcdir build.
Need to look for reference/input images from srcdir as well.
2008-11-04 13:03:24 +00:00
Adrian Johnson
73bc278c7a Add pdf mime data test
To test that images in PDF files correctly embedded the mime data.
2008-11-04 22:39:36 +10:30