[Flac-dev] [PATCH] Fix use of uninitialized variable

Takashi Iwai tiwai at suse.de
Wed May 25 08:03:11 PDT 2005


Hi,

the patch below fixes a possible bug accessing an uninitialized
variable.

The patch is to 1.1.2.


Takashi


--- src/metaflac/options.c-dist	2005-05-25 16:23:34.000000000 +0200
+++ src/metaflac/options.c	2005-05-25 16:23:42.000000000 +0200
@@ -555,13 +555,14 @@ FLAC__bool parse_option(int option_index
 			FLAC__ASSERT(0 != violation);
 			fprintf(stderr, "ERROR (--%s): malformed seekpoint specification \"%s\",\n       %s\n", opt, option_argument, violation);
 			ok = false;
+		} else {
+			op = find_shorthand_operation(options, OP__ADD_SEEKPOINT);
+			if(0 == op)
+				op = append_shorthand_operation(options, OP__ADD_SEEKPOINT);
+			local_strcat(&(op->argument.add_seekpoint.specification), spec);
+			local_strcat(&(op->argument.add_seekpoint.specification), ";");
+			free(spec);
 		}
-		op = find_shorthand_operation(options, OP__ADD_SEEKPOINT);
-		if(0 == op)
-			op = append_shorthand_operation(options, OP__ADD_SEEKPOINT);
-		local_strcat(&(op->argument.add_seekpoint.specification), spec);
-		local_strcat(&(op->argument.add_seekpoint.specification), ";");
-		free(spec);
 	}
 	else if(0 == strcmp(opt, "add-replay-gain")) {
 		(void) append_shorthand_operation(options, OP__ADD_REPLAY_GAIN);


More information about the Flac-dev mailing list