av_buffer_pool_get
API 概述
av_buffer_pool_get 是 ffmpeg 中的一个API。该规属于api pair 类型。该规则是使用 ChatDetector 生成的。
规则描述
提示
The return value of av_buffer_pool_get must be released by calling av_buffer_unref, with the same object passed as the 1-th argument to av_buffer_unref
信息
标签:api pair
参数下标:-1
CWE类别:CWE-404
规则代码
import cpp
import semmle.code.cpp.dataflow.new.DataFlow
DataFlow::Node getSource(FunctionCall fc){
fc.getTarget().hasName("av_buffer_pool_get")
and result.asExpr() = fc
}
DataFlow::Node getSink(FunctionCall fc){
fc.getTarget().hasName("av_buffer_unref")
and result.asExpr() = fc.getArgument(0)
}
FunctionCall freeTarget(FunctionCall malloc){
DataFlow::localFlow(getSource(malloc), getSink(result))
}
from FunctionCall fc
where fc.getTarget().hasName("av_buffer_pool_get")
and not exists(
FunctionCall free|
free = freeTarget(fc)
)
select fc.getLocation()