Changeset 88e425f


Ignore:
Timestamp:
May 13, 2010, 2:28:14 PM (14 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
e54a746
Parents:
0881cdd
git-author:
David Benjamin <davidben@mit.edu> (05/13/10 14:09:43)
git-committer:
David Benjamin <davidben@mit.edu> (05/13/10 14:28:14)
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

    r14965e5 r88e425f  
    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.