mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-28 04:03:39 +08:00
Work around false positive RESOURCE_LEAK in coverity scan
Fixes defect number 7520322
This commit is contained in:
parent
82b7e6de69
commit
3083e0ea80
|
@ -313,7 +313,10 @@ char *wcs2str(const wchar_t *in) {
|
|||
// Here we probably allocate a buffer probably much larger than necessary.
|
||||
char *out = (char *)malloc(MAX_UTF8_BYTES * wcslen(in) + 1);
|
||||
assert(out);
|
||||
return wcs2str_internal(in, out);
|
||||
//Instead of returning the return value of wcs2str_internal, return `out` directly.
|
||||
//This eliminates false warnings in coverity about resource leaks.
|
||||
wcs2str_internal(in, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
char *wcs2str(const wcstring &in) { return wcs2str(in.c_str()); }
|
||||
|
|
Loading…
Reference in New Issue
Block a user