projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: filter-parser.y: use zmalloc(), missing OOM check
[lttng-tools.git]
/
src
/
lib
/
lttng-ctl
/
filter
/
filter-parser.y
diff --git
a/src/lib/lttng-ctl/filter/filter-parser.y
b/src/lib/lttng-ctl/filter/filter-parser.y
index d746f78e8d82918c6109170e6fced1f1b70a5dca..92499e075c9a9bc0c53c3a19ea1cc5b9662a30c3 100644
(file)
--- a/
src/lib/lttng-ctl/filter/filter-parser.y
+++ b/
src/lib/lttng-ctl/filter/filter-parser.y
@@
-89,9
+89,13
@@
static struct gc_string *gc_string_alloc(struct filter_parser_ctx *parser_ctx,
for (alloclen = 8; alloclen < sizeof(long) + sizeof(*gstr) + len;
alloclen *= 2);
for (alloclen = 8; alloclen < sizeof(long) + sizeof(*gstr) + len;
alloclen *= 2);
- gstr = malloc(alloclen);
+ gstr = zmalloc(alloclen);
+ if (!gstr) {
+ goto end;
+ }
cds_list_add(&gstr->gc, &parser_ctx->allocated_strings);
gstr->alloclen = alloclen;
cds_list_add(&gstr->gc, &parser_ctx->allocated_strings);
gstr->alloclen = alloclen;
+end:
return gstr;
}
return gstr;
}
@@
-143,7
+147,7
@@
static struct filter_node *make_node(struct filter_parser_ctx *scanner,
struct filter_ast *ast = filter_parser_get_ast(scanner);
struct filter_node *node;
struct filter_ast *ast = filter_parser_get_ast(scanner);
struct filter_node *node;
- node = malloc(sizeof(*node));
+ node =
z
malloc(sizeof(*node));
if (!node)
return NULL;
memset(node, 0, sizeof(*node));
if (!node)
return NULL;
memset(node, 0, sizeof(*node));
@@
-180,7
+184,7
@@
static struct filter_node *make_op_node(struct filter_parser_ctx *scanner,
struct filter_ast *ast = filter_parser_get_ast(scanner);
struct filter_node *node;
struct filter_ast *ast = filter_parser_get_ast(scanner);
struct filter_node *node;
- node = malloc(sizeof(*node));
+ node =
z
malloc(sizeof(*node));
if (!node)
return NULL;
memset(node, 0, sizeof(*node));
if (!node)
return NULL;
memset(node, 0, sizeof(*node));
@@
-222,7
+226,7
@@
static struct filter_ast *filter_ast_alloc(void)
{
struct filter_ast *ast;
{
struct filter_ast *ast;
- ast = malloc(sizeof(*ast));
+ ast =
z
malloc(sizeof(*ast));
if (!ast)
return NULL;
memset(ast, 0, sizeof(*ast));
if (!ast)
return NULL;
memset(ast, 0, sizeof(*ast));
@@
-254,7
+258,7
@@
struct filter_parser_ctx *filter_parser_ctx_alloc(FILE *input)
yydebug = filter_parser_debug;
yydebug = filter_parser_debug;
- parser_ctx = malloc(sizeof(*parser_ctx));
+ parser_ctx =
z
malloc(sizeof(*parser_ctx));
if (!parser_ctx)
return NULL;
memset(parser_ctx, 0, sizeof(*parser_ctx));
if (!parser_ctx)
return NULL;
memset(parser_ctx, 0, sizeof(*parser_ctx));
This page took
0.026327 seconds
and
4
git commands to generate.