Project

General

Profile

Actions

Bug #6659

closed

nvlist_free(NULL) is a no-op

Added by Josef Sipek over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
2016-02-15
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:
External Bug:

Description

There are a lot of places in the gate that conditionally call nvlist_free() to avoid passing a NULL pointer. It turns out that nvlist_free(NULL) is a no-op (much like free(NULL)), so we can safely remove the condition in the callers.

The change was generated using the Coccinelle patch (see attached) and then tweaked a little by hand to nuke some useless whitespace.


Files

patch.cocci (186 Bytes) patch.cocci Josef Sipek, 2016-02-15 03:58 PM
patch2.cocci (80 Bytes) patch2.cocci Josef Sipek, 2016-02-15 05:36 PM
Actions #1

Updated by Josef Sipek over 7 years ago

Second semantic patch to catch more "bad" users of nvlist_free()

Actions #2

Updated by Electric Monk over 7 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit aab83bb83be7342f6cfccaed8d5fe0b2f404855d

commit  aab83bb83be7342f6cfccaed8d5fe0b2f404855d
Author: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Date:   2016-02-27T16:52:10.000Z

    6659 nvlist_free(NULL) is a no-op
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Marcel Telka <marcel@telka.sk>
    Approved by: Robert Mustacchi <rm@joyent.com>

Actions

Also available in: Atom PDF