Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
r.out.png: fix consecutive fclose calls on same pointer (OSGeo#4214)
This patch fixes two issues: 1. In one of the code paths, we are calling fclose on a file pointer which could potentially be NULL. Doing that would lead to undefined behavior. Check if a file pointer is NULL before closing it. 2. If we call fclose on same file pointer twice, in the second instance we could be closing file descriptor allocated to some other file, which typically happens to a freed descriptor. This issue was found by using cppcheck tool. Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
- Loading branch information