Skip to content

Commit

Permalink
Fix: lttng: snapshot: add-output: leak of max size parameter
Browse files Browse the repository at this point in the history
==1920281==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6 byte(s) in 1 object(s) allocated from:
    #0 0x7fa95633add9 in __interceptor_malloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fa955e90c09  (/usr/lib/libpopt.so.0+0x3c09)

Signed-off-by: Jérémie Galarneau <[email protected]>
Change-Id: I87ce90a77d9624add0cab5d3090a7e83734da7f4
  • Loading branch information
jgalar committed May 18, 2022
1 parent 29c79fa commit ef577d6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bin/lttng/commands/snapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,9 +624,12 @@ int cmd_snapshot(int argc, const char **argv)
case OPT_MAX_SIZE:
{
uint64_t val;
const char *max_size_arg = poptGetOptArg(pc);
char *max_size_arg = poptGetOptArg(pc);
const int parse_ret = utils_parse_size_suffix(
(char *) max_size_arg, &val);

if (utils_parse_size_suffix((char *) max_size_arg, &val) < 0) {
free(max_size_arg);
if (parse_ret < 0) {
ERR("Unable to handle max-size value %s",
max_size_arg);
cmd_ret = CMD_ERROR;
Expand Down

0 comments on commit ef577d6

Please sign in to comment.