[darwinbuild-changes] [485] branches/PR-6688645/darwinup/main.cpp
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 18 16:39:59 PDT 2009
Revision: 485
http://trac.macosforge.org/projects/darwinbuild/changeset/485
Author: wsiegrist at apple.com
Date: 2009-03-18 16:39:58 -0700 (Wed, 18 Mar 2009)
Log Message:
-----------
Properly make and free the path string when no -p option is set
Modified Paths:
--------------
branches/PR-6688645/darwinup/main.cpp
Modified: branches/PR-6688645/darwinup/main.cpp
===================================================================
--- branches/PR-6688645/darwinup/main.cpp 2009-03-18 21:45:36 UTC (rev 484)
+++ branches/PR-6688645/darwinup/main.cpp 2009-03-18 23:39:58 UTC (rev 485)
@@ -53,7 +53,10 @@
int main(int argc, char* argv[]) {
char* progname = strdup(basename(argv[0]));
+
char* path;
+ int custom_path = 0;
+
int ch;
while ((ch = getopt(argc, argv, "p:v")) != -1) {
switch (ch) {
@@ -67,6 +70,7 @@
exit(3);
}
path = optarg;
+ custom_path = 1;
break;
case '?':
default:
@@ -77,6 +81,10 @@
argv += optind;
int res = 0;
+
+ if (!custom_path) {
+ asprintf(&path, "/");
+ }
Depot* depot = new Depot(path);
if (!depot->is_locked()) {
fprintf(stderr,
@@ -143,6 +151,9 @@
} else {
usage(progname);
}
+ if (!custom_path) {
+ free(path);
+ }
exit(res);
return res;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20090318/c69abd55/attachment.html>
More information about the darwinbuild-changes
mailing list