Commit 5a030214 authored by Michael Smith's avatar Michael Smith
Browse files

Fix some more silly errors, so it might actually work reliably, and might

even not leak as much memory.

svn path=/trunk/vorbis-tools/; revision=2085
parent 29b3efc1
...@@ -24,6 +24,7 @@ struct option long_options[] = { ...@@ -24,6 +24,7 @@ struct option long_options[] = {
{"help",0,0,'h'}, {"help",0,0,'h'},
{"quiet",0,0,'q'}, {"quiet",0,0,'q'},
{"commentfile",1,0,'c'}, {"commentfile",1,0,'c'},
{"encoding", 1,0,'e'},
{NULL,0,0,0} {NULL,0,0,0}
}; };
...@@ -228,6 +229,7 @@ int add_comment(char *line, vorbis_comment *vc, char *encoding) ...@@ -228,6 +229,7 @@ int add_comment(char *line, vorbis_comment *vc, char *encoding)
/* append the comment and return */ /* append the comment and return */
vorbis_comment_add_tag(vc, line, utf8_value); vorbis_comment_add_tag(vc, line, utf8_value);
free(utf8_value);
return 0; return 0;
} else { } else {
fprintf(stderr, "Couldn't convert comment to UTF8, " fprintf(stderr, "Couldn't convert comment to UTF8, "
...@@ -316,7 +318,7 @@ void parse_options(int argc, char *argv[], param_t *param) ...@@ -316,7 +318,7 @@ void parse_options(int argc, char *argv[], param_t *param)
int ret; int ret;
int option_index = 1; int option_index = 1;
while ((ret = getopt_long(argc, argv, "aelwhqc:t:", while ((ret = getopt_long(argc, argv, "ae:lwhqc:t:",
long_options, &option_index)) != -1) { long_options, &option_index)) != -1) {
switch (ret) { switch (ret) {
case 0: case 0:
...@@ -333,7 +335,7 @@ void parse_options(int argc, char *argv[], param_t *param) ...@@ -333,7 +335,7 @@ void parse_options(int argc, char *argv[], param_t *param)
param->mode = MODE_APPEND; param->mode = MODE_APPEND;
break; break;
case 'e': case 'e':
param->mode = strdup(optarg); param->encoding = strdup(optarg);
break; break;
case 'h': case 'h':
usage(); usage();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment