Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
bb298967
Commit
bb298967
authored
10 years ago
by
Michael Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
avutil/opencl: use av_malloc(z)_array()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
52fca28c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavutil/opencl.c
+4
-4
4 additions, 4 deletions
libavutil/opencl.c
with
4 additions
and
4 deletions
libavutil/opencl.c
+
4
−
4
View file @
bb298967
...
@@ -213,7 +213,7 @@ static int get_device_list(AVOpenCLDeviceList *device_list)
...
@@ -213,7 +213,7 @@ static int get_device_list(AVOpenCLDeviceList *device_list)
"Could not get OpenCL platform ids: %s
\n
"
,
av_opencl_errstr
(
status
));
"Could not get OpenCL platform ids: %s
\n
"
,
av_opencl_errstr
(
status
));
return
AVERROR_EXTERNAL
;
return
AVERROR_EXTERNAL
;
}
}
platform_ids
=
av_mallocz
(
device_list
->
platform_num
*
sizeof
(
cl_platform_id
));
platform_ids
=
av_mallocz
_array
(
device_list
->
platform_num
,
sizeof
(
cl_platform_id
));
if
(
!
platform_ids
)
if
(
!
platform_ids
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
status
=
clGetPlatformIDs
(
device_list
->
platform_num
,
platform_ids
,
NULL
);
status
=
clGetPlatformIDs
(
device_list
->
platform_num
,
platform_ids
,
NULL
);
...
@@ -223,7 +223,7 @@ static int get_device_list(AVOpenCLDeviceList *device_list)
...
@@ -223,7 +223,7 @@ static int get_device_list(AVOpenCLDeviceList *device_list)
ret
=
AVERROR_EXTERNAL
;
ret
=
AVERROR_EXTERNAL
;
goto
end
;
goto
end
;
}
}
device_list
->
platform_node
=
av_mallocz
(
device_list
->
platform_num
*
sizeof
(
AVOpenCLPlatformNode
*
));
device_list
->
platform_node
=
av_mallocz
_array
(
device_list
->
platform_num
,
sizeof
(
AVOpenCLPlatformNode
*
));
if
(
!
device_list
->
platform_node
)
{
if
(
!
device_list
->
platform_node
)
{
ret
=
AVERROR
(
ENOMEM
);
ret
=
AVERROR
(
ENOMEM
);
goto
end
;
goto
end
;
...
@@ -249,14 +249,14 @@ static int get_device_list(AVOpenCLDeviceList *device_list)
...
@@ -249,14 +249,14 @@ static int get_device_list(AVOpenCLDeviceList *device_list)
device_type
[
j
],
0
,
NULL
,
&
devices_num
[
j
]);
device_type
[
j
],
0
,
NULL
,
&
devices_num
[
j
]);
total_devices_num
+=
devices_num
[
j
];
total_devices_num
+=
devices_num
[
j
];
}
}
device_list
->
platform_node
[
i
]
->
device_node
=
av_mallocz
(
total_devices_num
*
sizeof
(
AVOpenCLDeviceNode
*
));
device_list
->
platform_node
[
i
]
->
device_node
=
av_mallocz
_array
(
total_devices_num
,
sizeof
(
AVOpenCLDeviceNode
*
));
if
(
!
device_list
->
platform_node
[
i
]
->
device_node
)
{
if
(
!
device_list
->
platform_node
[
i
]
->
device_node
)
{
ret
=
AVERROR
(
ENOMEM
);
ret
=
AVERROR
(
ENOMEM
);
goto
end
;
goto
end
;
}
}
for
(
j
=
0
;
j
<
FF_ARRAY_ELEMS
(
device_type
);
j
++
)
{
for
(
j
=
0
;
j
<
FF_ARRAY_ELEMS
(
device_type
);
j
++
)
{
if
(
devices_num
[
j
])
{
if
(
devices_num
[
j
])
{
device_ids
=
av_mallocz
(
devices_num
[
j
]
*
sizeof
(
cl_device_id
));
device_ids
=
av_mallocz
_array
(
devices_num
[
j
]
,
sizeof
(
cl_device_id
));
if
(
!
device_ids
)
{
if
(
!
device_ids
)
{
ret
=
AVERROR
(
ENOMEM
);
ret
=
AVERROR
(
ENOMEM
);
goto
end
;
goto
end
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment