This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new e3bbcc0  Added null device check in os_dev_close (#1850)
e3bbcc0 is described below

commit e3bbcc07321741e73586016a9f4fa1cf68aa7d97
Author: Grant Freese <gr...@x146.com>
AuthorDate: Thu May 30 19:38:48 2019 -0700

    Added null device check in os_dev_close (#1850)
---
 kernel/os/src/os_dev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/os/src/os_dev.c b/kernel/os/src/os_dev.c
index cf7779b..b1aee6a 100644
--- a/kernel/os/src/os_dev.c
+++ b/kernel/os/src/os_dev.c
@@ -238,6 +238,11 @@ os_dev_close(struct os_dev *dev)
     int rc;
     os_sr_t sr;
 
+    if (dev == NULL) {
+        rc = OS_EINVAL;
+        goto err;
+    }
+
     if (dev->od_handlers.od_close) {
         rc = dev->od_handlers.od_close(dev);
         if (rc != 0) {

Reply via email to