mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Cleanup: avoid dereferencing NULL pointer
Coverity CID 208330 Coverity CID 208301 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e8719413a7
commit
6cc5b601aa
1 changed files with 10 additions and 2 deletions
12
core/file.c
12
core/file.c
|
@ -927,6 +927,11 @@ int parse_dan_format(const char *filename, char **params, int pnr)
|
|||
++iter;
|
||||
}
|
||||
|
||||
if (!iter) {
|
||||
fprintf(stderr, "DEBUG: Data corrupt");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Setting date */
|
||||
memcpy(tmpbuf, iter, 8);
|
||||
tmpbuf[8] = 0;
|
||||
|
@ -950,9 +955,12 @@ int parse_dan_format(const char *filename, char **params, int pnr)
|
|||
}
|
||||
if (ptr)
|
||||
ptr = strstr(ptr, NL);
|
||||
if (ptr)
|
||||
if (ptr) {
|
||||
ptr += strlen(NL);
|
||||
|
||||
} else {
|
||||
fprintf(stderr, "DEBUG: Data corrupt");
|
||||
return -1;
|
||||
}
|
||||
end_ptr = ptr - (char *)mem.buffer;
|
||||
|
||||
/* Copy the current dive data to start of mem_csv buffer */
|
||||
|
|
Loading…
Reference in a new issue