Message ID | 146896920956.18759.7000784801515467749.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Jul 19, 2016 at 04:00:09PM -0700, Dan Williams wrote: > Similar to libc free() allow NULL as a valid parameter to this freeing > routine. This mirrors the behavior of the other *_unref() routines in > the library. > > Cc: Tiffany Kasanicky <tiffany.j.kasanicky@intel.com> > Reported-by: Linda Knippers <linda.knippers@hpe.com> > Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c index 0722f79470c3..4b1247678a08 100644 --- a/ndctl/lib/libndctl.c +++ b/ndctl/lib/libndctl.c @@ -2122,6 +2122,8 @@ NDCTL_EXPORT int ndctl_dimm_zero_labels(struct ndctl_dimm *dimm) NDCTL_EXPORT void ndctl_cmd_unref(struct ndctl_cmd *cmd) { + if (!cmd) + return; if (--cmd->refcount == 0) { if (cmd->source) ndctl_cmd_unref(cmd->source);
Similar to libc free() allow NULL as a valid parameter to this freeing routine. This mirrors the behavior of the other *_unref() routines in the library. Cc: Tiffany Kasanicky <tiffany.j.kasanicky@intel.com> Reported-by: Linda Knippers <linda.knippers@hpe.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- ndctl/lib/libndctl.c | 2 ++ 1 file changed, 2 insertions(+)