Uploaded image for project: 'vpp'
  1. vpp
  2. VPP-635

CLI Memory leak with invalid parameter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • 17.04
    • 17.01
    • VPPInfra
    • None

      I see the following pattern in multiple CLI Command functions:

        /* Get a line of input. */
        if (!unformat_user (input, unformat_line_input, line_input))
          return 0;
      
        while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
          {
            if (unformat (line_input, "x"))
      	x = 1;
            else if (unformat (line_input, "y"))
      	y = 1;
            :
            else
      	return clib_error_return (0, "unknown input `%U'",
      				  format_unformat_error, line_input);
          }
        unformat_free (line_input);
      

      The 'else' returns if an unknown string is encountered. There a memory leak because the 'unformat_free(line_input)' is not called. There is a large number of instances of this pattern.

            BillyM Billy McFall
            BillyM Billy McFall
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 days
                4d