diff options
author | Sami Kerola | 2019-05-18 23:14:20 +0200 |
---|---|---|
committer | Sami Kerola | 2019-05-18 23:17:10 +0200 |
commit | cbcedf6ba83b0929ad21e227db62883886d2ccce (patch) | |
tree | 3fd0564c8e557035b2d3e21e646fc6f08e3e230d /libmount | |
parent | lib/mangle: fix possible null pointer dereference [cppcheck] (diff) | |
download | kernel-qcow2-util-linux-cbcedf6ba83b0929ad21e227db62883886d2ccce.tar.gz kernel-qcow2-util-linux-cbcedf6ba83b0929ad21e227db62883886d2ccce.tar.xz kernel-qcow2-util-linux-cbcedf6ba83b0929ad21e227db62883886d2ccce.zip |
libmount: avoid possible null pointer dereference [cppcheck]
[libmount/src/monitor.c:797]: (warning) Possible null pointer dereference: me
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'libmount')
-rw-r--r-- | libmount/src/monitor.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libmount/src/monitor.c b/libmount/src/monitor.c index 2383a734a..730c8bdea 100644 --- a/libmount/src/monitor.c +++ b/libmount/src/monitor.c @@ -794,14 +794,17 @@ int mnt_monitor_next_change(struct libmnt_monitor *mn, me = NULL; } - me->changed = 0; + if (me) { + me->changed = 0; - if (filename) - *filename = me->path; - if (type) - *type = me->type; + if (filename) + *filename = me->path; + if (type) + *type = me->type; - DBG(MONITOR, ul_debugobj(mn, " *** success [changed: %s]", me->path)); + DBG(MONITOR, ul_debugobj(mn, " *** success [changed: %s]", me->path)); + } else + return -EINVAL; return 0; /* success */ } |