aboutsummaryrefslogtreecommitdiff
path: root/pd/src/s_path.c
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2005-10-15 23:14:28 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2005-10-15 23:14:28 +0000
commit9ac980fd47d057cccd89eb52909bd2afec79569a (patch)
tree84594bdc9f730e873c051d3085317827610b00fc /pd/src/s_path.c
parentc23dc858c7362d6f72b797e5d06f3f81280d67b9 (diff)
Bug fixes, notably for mac if no audio input device is available; also
worked around a problem in ASIO support on MSW (but need to fix it better.) svn path=/trunk/; revision=3717
Diffstat (limited to 'pd/src/s_path.c')
-rw-r--r--pd/src/s_path.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/pd/src/s_path.c b/pd/src/s_path.c
index 076f2822..fe9f8d32 100644
--- a/pd/src/s_path.c
+++ b/pd/src/s_path.c
@@ -375,6 +375,12 @@ int sys_rcfile(void)
char* rcargv[NUMARGS];
char* buffer;
char fname[MAXPDSTRING], buf[1000], *home = getenv("HOME");
+ int retval = 1; /* that's what we will return at the end; for now, let's think it'll be an error */
+
+ /* initialize rc-arg-array so we can safely clean up at the end */
+ for (i = 1; i < NUMARGS-1; i++)
+ rcargv[i]=0;
+
/* parse a startup file */
@@ -398,7 +404,7 @@ int sys_rcfile(void)
break;
buf[1000] = 0;
if (!(rcargv[i] = malloc(strlen(buf) + 1)))
- return (1);
+ goto cleanup;
strcpy(rcargv[i], buf);
}
if (i >= NUMARGS-1)
@@ -423,9 +429,17 @@ int sys_rcfile(void)
if (sys_argparse(rcargc-1, rcargv+1))
{
post("error parsing RC arguments");
- return (1);
+ goto cleanup;
}
- return (0);
+
+ retval=0; /* we made it without an error */
+
+
+ cleanup: /* prevent memleak */
+ for (i = 1; i < NUMARGS-1; i++)
+ if(rcargv[i])free(rcargv[i]);
+
+ return(retval);
}
#endif /* MSW */