Open kaprakashr opened 8 years ago
cli_parse_inline
while (nwords < max_words - 1)
{
if (!*p || *p == inquote || (word_start && !inquote && (isspace(*p) || *p == '|')))
{
if (word_start)
{
int len = p - word_start;
memcpy(words[nwords] = malloc(len + 1), word_start, len); <== later, this is not freed properly
words[nwords++][len] = 0;
}
Constant Memory leak found at this trace. Every time we try to search in CLI,
==7781== LEAK SUMMARY:
==7781== definitely lost: 114 bytes in 20 blocks ==7781== 114 bytes in 20 blocks are definitely lost in loss record 85 of 90
Trace
==7781== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==7781== by 0x4E3971F: cli_parse_line.constprop.5 (libcli.c:670) ==7781== by 0x4E3CD13: cli_loop (libcli.c:989) ==7781== by 0x4010A1: main (in /home/kalyan/cloutra/src/cli/a.out)