Fix an uninitialized variable. If it didn't end up being zero it sometimes

caused a seg fault, sometimes executed somewhere else.  Also add an error if
the algorithm is unknown.

Signed-off-by: Myles Watson <mylesgw@gmail.com>
Acked-by: Ward Vandewege <ward@gnu.org>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4198 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Myles Watson 2009-04-23 18:46:32 +00:00
parent 436b9de0a3
commit 06db2c4482
1 changed files with 4 additions and 1 deletions

View File

@ -191,7 +191,7 @@ err:
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
void (*compress) (char *, int, char *, int *); void (*compress) (char *, int, char *, int *);
int algo; int algo = CBFS_COMPRESS_NONE;
char *output = NULL; char *output = NULL;
char *input = NULL; char *input = NULL;
@ -251,6 +251,9 @@ int main(int argc, char **argv)
case CBFS_COMPRESS_LZMA: case CBFS_COMPRESS_LZMA:
compress = lzma_compress; compress = lzma_compress;
break; break;
default:
fprintf(stderr, "E: Unknown compression algorithm %d!\n", algo);
return -1;
} }
osize = parse_elf(buffer, &obuffer, algo, compress); osize = parse_elf(buffer, &obuffer, algo, compress);