projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tests: fix: leak caused by misuse of realloc in multi-lib-test
[lttng-tools.git]
/
tests
/
regression
/
ust
/
multi-lib
/
multi-lib-test.c
diff --git
a/tests/regression/ust/multi-lib/multi-lib-test.c
b/tests/regression/ust/multi-lib/multi-lib-test.c
index e145aa21aeae49e8310dc498c40e301499b88126..b5b2f314764af0ee5ff32706b1850fc464e34821 100644
(file)
--- a/
tests/regression/ust/multi-lib/multi-lib-test.c
+++ b/
tests/regression/ust/multi-lib/multi-lib-test.c
@@
-201,12
+201,15
@@
int main(int argc, const char **argv)
* Populate the libraries array with the arguments passed to the process.
*/
while (poptPeekArg(optCon) != NULL) {
* Populate the libraries array with the arguments passed to the process.
*/
while (poptPeekArg(optCon) != NULL) {
+ char **realloced_libraries = NULL;
+
nb_libraries++;
nb_libraries++;
- libraries = realloc(libraries, nb_libraries * sizeof(char *));
- if (!libraries) {
+
realloced_
libraries = realloc(libraries, nb_libraries * sizeof(char *));
+ if (!
realloced_
libraries) {
ret = -1;
goto error;
}
ret = -1;
goto error;
}
+ libraries = realloced_libraries;
libraries[nb_libraries - 1] = (char *) poptGetArg(optCon);
}
libraries[nb_libraries - 1] = (char *) poptGetArg(optCon);
}
This page took
0.027063 seconds
and
4
git commands to generate.