pipebuffer: handle possible null pointer dereference
reported by clang static analyzer
This commit is contained in:
@@ -53,6 +53,8 @@ static INLINE struct malloc_buffer *
|
||||
malloc_buffer(struct pb_buffer *buf)
|
||||
{
|
||||
assert(buf);
|
||||
if (!buf)
|
||||
return NULL;
|
||||
assert(buf->vtbl == &malloc_buffer_vtbl);
|
||||
return (struct malloc_buffer *)buf;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,8 @@ static INLINE struct pb_ondemand_buffer *
|
||||
pb_ondemand_buffer(struct pb_buffer *buf)
|
||||
{
|
||||
assert(buf);
|
||||
if (!buf)
|
||||
return NULL;
|
||||
assert(buf->vtbl == &pb_ondemand_buffer_vtbl);
|
||||
return (struct pb_ondemand_buffer *)buf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user