Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
Obuspa Test Controller
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BBF
Obuspa Test Controller
Commits
1cf32fa4
Commit
1cf32fa4
authored
11 months ago
by
Suvendhu Hansa
Committed by
Vivek Dutta
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix compilation error
parent
6df13f66
Branches
devel
No related tags found
1 merge request
!12
Fix compile error
Pipeline
#144781
passed
11 months ago
Stage: static_code_analysis
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/usp_mem.c
+24
-21
24 additions, 21 deletions
src/core/usp_mem.c
with
24 additions
and
21 deletions
src/core/usp_mem.c
+
24
−
21
View file @
1cf32fa4
...
...
@@ -270,9 +270,6 @@ void USP_MEM_Free(const char *func, int line, void *ptr)
{
minfo_t
*
mi
;
// Free the memory
free
(
ptr
);
#ifndef __clang_analyzer__
// Clang static analyser goes wrong here because the ptr in meminfo is just an address used as a key; ptr is not owned by meminfo
...
...
@@ -293,6 +290,9 @@ void USP_MEM_Free(const char *func, int line, void *ptr)
OS_UTILS_UnlockMutex
(
&
mem_access_mutex
);
}
#endif
// Free the memory
free
(
ptr
);
}
/*********************************************************************//**
...
...
@@ -311,16 +311,9 @@ void USP_MEM_Free(const char *func, int line, void *ptr)
**************************************************************************/
void
*
USP_MEM_Realloc
(
const
char
*
func
,
int
line
,
void
*
ptr
,
int
size
)
{
minfo_t
*
mi
;
minfo_t
*
mi
=
NULL
;
void
*
new_ptr
;
// Terminate if out of memory
new_ptr
=
realloc
(
ptr
,
size
);
if
(
new_ptr
==
NULL
)
{
USP_ERR_Terminate
(
"%s (%d): realloc(%d bytes) failed"
,
func
,
line
,
size
);
}
#ifndef __clang_analyzer__
// Clang static analyser goes wrong here because the ptr in meminfo is just an address used as a key; ptr is not owned by meminfo
...
...
@@ -330,19 +323,29 @@ void *USP_MEM_Realloc(const char *func, int line, void *ptr, int size)
OS_UTILS_LockMutex
(
&
mem_access_mutex
);
tr_mem
(
"%s(%d): realloc(%p, %d) = %p"
,
func
,
line
,
ptr
,
size
,
new_ptr
);
mi
=
FindMemInfoByPtr
(
ptr
);
if
(
mi
!=
NULL
)
{
mi
->
ptr
=
new_ptr
;
mi
->
func
=
func
;
mi
->
line
=
line
;
mi
->
size
=
size
;
mi
->
flags
|=
MI_MODIFIED
;
GetCallers
(
mi
->
callers
,
NUM_ELEM
(
mi
->
callers
));
}
else
if
(
mi
==
NULL
)
{
USP_ERR_Terminate
(
"Trying to reallocate memory that was not allocated"
);
}
}
#endif
// Terminate if out of memory
new_ptr
=
realloc
(
ptr
,
size
);
if
(
new_ptr
==
NULL
)
{
USP_ERR_Terminate
(
"%s (%d): realloc(%d bytes) failed"
,
func
,
line
,
size
);
}
#ifndef __clang_analyzer__
if
((
collect_memory_info
)
&&
(
mi
!=
NULL
))
{
mi
->
ptr
=
new_ptr
;
mi
->
func
=
func
;
mi
->
line
=
line
;
mi
->
size
=
size
;
mi
->
flags
|=
MI_MODIFIED
;
GetCallers
(
mi
->
callers
,
NUM_ELEM
(
mi
->
callers
));
OS_UTILS_UnlockMutex
(
&
mem_access_mutex
);
}
#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