Changeset 51a56b3


Ignore:
Timestamp:
May 24, 2010, 8:22:54 PM (10 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
release-1.6
Children:
935b8d8
Parents:
70087b9
git-author:
David Benjamin <davidben@mit.edu> (05/13/10 14:09:43)
git-committer:
Nelson Elhage <nelhage@mit.edu> (05/24/10 20:22:54)
Message:
Free temporary argv in done segment

Otherwise we leak memory when failing out of the getopt loop. We also
can punt the strdups, as getopt doesn't mutate them.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r774f439 r51a56b3  
    12971297
    12981298  for (i = 0; i < argc; i++)
    1299     tmp_argv[i] = owl_strdup(argv[i]);
     1299    tmp_argv[i] = argv[i];
    13001300
    13011301  static struct option options[] = {
     
    13171317  }
    13181318
    1319   for (i = 0; i < argc; i++)
    1320     owl_free(tmp_argv[i]);
    1321   owl_free(tmp_argv);
    1322 
    13231319  filtname = owl_function_smartfilter(instance, related);
    13241320
     
    13291325
    13301326done:
     1327  owl_free(tmp_argv);
     1328
    13311329  optind = 0; /* reset getopt */
    13321330  return NULL;
Note: See TracChangeset for help on using the changeset viewer.