Bug 90855

Summary: Dangling pointer Issue in _cairo_surface_snapshot_acquire_source_image API.
Product: cairo Reporter: Amarnath <a.amarnath>
Component: generalAssignee: Chris Wilson <chris>
Status: RESOLVED NOTABUG QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: major    
Priority: medium    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: This is patch file attached to fix the issue.

Description Amarnath 2015-06-05 03:14:56 UTC
Created attachment 116296 [details]
This is patch file attached to fix the issue.

After freeing any pointer which is pointing to dynamically allocated memory, Null should be assigned to pointer immediately after freeing to avoid dangling pointer situation.
In the code after freeing the memory under some condition null was not assigned to the pointer and outside the condition block it was getting assigned to another pointer.
Comment 1 Chris Wilson 2015-06-05 06:59:32 UTC
Accessing the pointer after the function returns an error is a much more severe error.

Better style is not to touch out parameters along error paths.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.