Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dav1d
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joey Reinhart
dav1d
Commits
e2d41a4a
Verified
Commit
e2d41a4a
authored
2 months ago
by
Joey Reinhart
Browse files
Options
Downloads
Patches
Plain Diff
NULL checking
parent
4d6a7914
Branches
master
No related tags found
No related merge requests found
Pipeline
#558411
failed with stages
in 1 hour, 2 minutes, and 49 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mem.h
+7
-5
7 additions, 5 deletions
src/mem.h
with
7 additions
and
5 deletions
src/mem.h
+
7
−
5
View file @
e2d41a4a
...
...
@@ -101,10 +101,12 @@ static inline void *dav1d_alloc_aligned_internal(const size_t sz, const size_t a
// must be an integral multiple of alignment.
return
aligned_alloc
(
align
,
ROUND_UP
(
sz
,
align
));
#else
char
*
ptr
=
(
char
*
)
malloc
(
sz
+
align
+
sizeof
(
void
*
));
char
*
result
=
(
char
*
)(((
size_t
)
ptr
+
sizeof
(
void
*
)
+
align
-
1
)
&
~
(
align
-
1
));
((
char
**
)
result
)[
-
1
]
=
ptr
;
return
result
;
void
*
const
buf
=
malloc
(
sz
+
align
+
sizeof
(
void
*
));
if
(
!
buf
)
return
NULL
;
void
*
const
ptr
=
(
void
*
)(((
uintptr_t
)
buf
+
sizeof
(
void
*
)
+
align
-
1
)
&
~
(
align
-
1
));
((
void
**
)
ptr
)[
-
1
]
=
buf
;
return
ptr
;
#endif
}
...
...
@@ -114,7 +116,7 @@ static inline void dav1d_free_aligned_internal(void *ptr) {
#elif HAVE_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_ALIGNED_ALLOC
free
(
ptr
);
#else
free
(((
void
**
)
ptr
)[
-
1
]);
if
(
ptr
)
free
(((
void
**
)
ptr
)[
-
1
]);
#endif
}
...
...
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