mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: Fix Problems Raised by Coverity Scan.
Opportunistically fix some problems newly raised by a recent Coverity scan. Not touching any of the string memory allocation issues as this is being handled by the move towards C++ strings. Signed-off-by: Michael Keller <mikeller@042.ch>
This commit is contained in:
parent
3229d1e3a1
commit
e6ff3f7537
3 changed files with 11 additions and 10 deletions
|
@ -452,11 +452,12 @@ static std::string parse_mkvi_value(const char *haystack, const char *needle)
|
|||
if ((lineptr = strstr(haystack, needle)) != NULL) {
|
||||
if ((valueptr = strstr(lineptr, ": ")) != NULL) {
|
||||
valueptr += 2;
|
||||
}
|
||||
if ((endptr = strstr(lineptr, "\n")) != NULL) {
|
||||
if (*(endptr - 1) == '\r')
|
||||
--endptr;
|
||||
return std::string(valueptr, endptr - valueptr);
|
||||
|
||||
if ((endptr = strstr(lineptr, "\n")) != NULL) {
|
||||
if (*(endptr - 1) == '\r')
|
||||
--endptr;
|
||||
return std::string(valueptr, endptr - valueptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::string();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue