There were a couple of cases where we could try to unref a command that
had never been initialized. Fix those by always initializing the cmd
pointers to NULL.
Cc: Dan Williams <dan.j.williams(a)intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma(a)intel.com>
---
ndctl/inject-smart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ndctl/inject-smart.c b/ndctl/inject-smart.c
index 02f8b0e..45dbc8d 100644
--- a/ndctl/inject-smart.c
+++ b/ndctl/inject-smart.c
@@ -221,7 +221,7 @@ static int smart_init(void)
static int smart_set_thresh(struct ndctl_dimm *dimm)
{
const char *name = ndctl_dimm_get_devname(dimm);
- struct ndctl_cmd *st_cmd, *sst_cmd;
+ struct ndctl_cmd *st_cmd = NULL, *sst_cmd = NULL;
int rc = -EOPNOTSUPP;
st_cmd = ndctl_dimm_cmd_new_smart_threshold(dimm);
@@ -332,7 +332,7 @@ out:
static int smart_inject(struct ndctl_dimm *dimm)
{
const char *name = ndctl_dimm_get_devname(dimm);
- struct ndctl_cmd *si_cmd;
+ struct ndctl_cmd *si_cmd = NULL;
int rc = -EOPNOTSUPP;
send_inject_val(media_temperature)
--
2.14.3