mirror of https://github.com/vitalif/e2fsprogs
[COVERITY] Fix memory leak in libss (ss_execute_line)
Fix a memory leak by freeing the argv[] array if ss_parse_line returns 0 for argc 0 (which will happen if the user his return and sends an empty line to the application). Potentially need to free argv before early return since it was allocated memory. Need to be careful since it may be possible for ss_parse() to have freed the memory allocated to it if it detects an unbalanced set of quotes passed to it. Coverity ID: 21: Resource Leak Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>bitmap-optimize
parent
f1d6a0797b
commit
f19c46dfbc
|
@ -1,3 +1,10 @@
|
||||||
|
2007-03-21 Theodore Tso <tytso@mit.edu>
|
||||||
|
|
||||||
|
* execute_cmd.c (ss_execute_line): Fix a memory leak by freeing
|
||||||
|
the argv[] array if ss_parse_line returns 0 for argc 0
|
||||||
|
(which will happen if the user his return and sends an
|
||||||
|
empty line to the application).
|
||||||
|
|
||||||
2007-03-19 Theodore Tso <tytso@mit.edu>
|
2007-03-19 Theodore Tso <tytso@mit.edu>
|
||||||
|
|
||||||
* help.c (ss_add_info_dir): Fix error checking for NULL parameter
|
* help.c (ss_add_info_dir): Fix error checking for NULL parameter
|
||||||
|
|
|
@ -220,8 +220,11 @@ int ss_execute_line (sci_idx, line_ptr)
|
||||||
|
|
||||||
/* parse it */
|
/* parse it */
|
||||||
argv = ss_parse(sci_idx, line_ptr, &argc);
|
argv = ss_parse(sci_idx, line_ptr, &argc);
|
||||||
if (argc == 0)
|
if (argc == 0) {
|
||||||
|
if (argv)
|
||||||
|
free(argv);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* look it up in the request tables, execute if found */
|
/* look it up in the request tables, execute if found */
|
||||||
ret = really_execute_command (sci_idx, argc, &argv);
|
ret = really_execute_command (sci_idx, argc, &argv);
|
||||||
|
|
Loading…
Reference in New Issue