diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2019-11-14 17:13:02 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2019-11-14 18:06:42 +0100 |
commit | 0bad3977df40a70c68778ff0514d0ca712fee402 (patch) | |
tree | f4d9c358f58c8193bb80c3dc1e30de61bc0dbe9d | |
parent | 153e55c20e9a3810a1862314a6465179e1b53931 (diff) | |
download | lvm2-0bad3977df40a70c68778ff0514d0ca712fee402.tar.gz |
cov: avoid passing NULL to strstr function
When 'str1' would be NULL, there is no point to run 2nd. strstr().
-rw-r--r-- | tools/pvck.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/pvck.c b/tools/pvck.c index 79fb8fbc7..1c1bbc241 100644 --- a/tools/pvck.c +++ b/tools/pvck.c @@ -420,11 +420,11 @@ static int _dump_all_text(struct cmd_context *cmd, const char *tofile, struct de memset(line, 0, sizeof(line)); _copy_line(str1, line, &len); log_print("%s", line); - } - if ((str2 = strstr(str1, "creation_time = "))) { - memset(line, 0, sizeof(line)); - _copy_line(str2, line, &len); - log_print("%s\n", line); + if ((str2 = strstr(str1, "creation_time = "))) { + memset(line, 0, sizeof(line)); + _copy_line(str2, line, &len); + log_print("%s\n", line); + } } } |