[CDRIVER-42] remove unnecessary test: if (p) free (p); -> free (p); Created: 17/Feb/11  Updated: 19/Oct/16  Resolved: 08/Apr/11

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 0.2

Type: Improvement Priority: Trivial - P5
Reporter: Jim Meyering Assignee: Kyle Banker
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

latest from git, Fedora 14, x86_64


Attachments: File 0001-remove-unnecessary-test-if-p-free-p-free-p.patch    
Backwards Compatibility: Fully Compatible

 Description   

There is no reason to ensure P is non-NULL before calling "free(P)".
(unless you still target SunOS4

  • src/gridfs.c (gridfs_destroy): Remove 4 unneeded tests.
    There is no longer (since SunOS 4) any need to guard against
    free (NULL), so replace each "if (p) free (p);" with "free (p);".

Patch attached:


Generated at Wed Feb 07 21:08:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.