diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-10-08 12:32:49 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-10-08 12:32:49 +0200 |
commit | cfd27ef2ad8b005fd47ab41ef29b71d9e3d48201 (patch) | |
tree | 56cb8849a5df91b19b72fd4f48c79c343cd9bc5e /backend/test.c | |
parent | ba8d09abe681600aad991f4a75e904615b7ed29f (diff) |
Imported Upstream version 1.0.25upstream/1.0.25
Diffstat (limited to 'backend/test.c')
-rw-r--r-- | backend/test.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/backend/test.c b/backend/test.c index 8f8851a..d5b7365 100644 --- a/backend/test.c +++ b/backend/test.c @@ -348,7 +348,7 @@ init_options (Test_Device * test_device) od->title = SANE_I18N ("Hand-scanner simulation"); od->desc = SANE_I18N ("Simulate a hand-scanner. Hand-scanners do not " "know the image height a priori. Instead, they " - "return a height of -1. Setting this option allows " + "return a height of -1. Setting this option allows one " "to test whether a frontend can handle this " "correctly. This option also enables a fixed width " "of 11 cm."); @@ -1120,7 +1120,10 @@ read_option (SANE_String line, SANE_String option_string, return SANE_STATUS_INVAL; if (strcmp (word, option_string) != 0) - return SANE_STATUS_INVAL; + { + free(word); + return SANE_STATUS_INVAL; + } free (word); word = 0; @@ -1240,7 +1243,6 @@ read_option (SANE_String line, SANE_String option_string, if (word) free (word); - word = 0; return SANE_STATUS_GOOD; } @@ -1453,7 +1455,7 @@ sane_init (SANE_Int * __sane_unused__ version_code, SANE_Auth_Callback __sane_un { FILE *fp; SANE_Int linenumber; - SANE_Char line[PATH_MAX], *word; + SANE_Char line[PATH_MAX], *word = NULL; SANE_String_Const cp; SANE_Device *sane_device; Test_Device *test_device, *previous_device; @@ -1481,7 +1483,9 @@ sane_init (SANE_Int * __sane_unused__ version_code, SANE_Auth_Callback __sane_un DBG (4, "sane_init: reading config file `%s'\n", TEST_CONFIG_FILE); while (sanei_config_read (line, sizeof (line), fp)) { - word = 0; + if (word) + free (word); + word = NULL; linenumber++; cp = sanei_config_get_string (line, &word); @@ -1490,8 +1494,6 @@ sane_init (SANE_Int * __sane_unused__ version_code, SANE_Auth_Callback __sane_un DBG (5, "sane_init: config file line %3d: ignoring empty line\n", linenumber); - if (word) - free (word); continue; } if (word[0] == '#') @@ -1499,7 +1501,6 @@ sane_init (SANE_Int * __sane_unused__ version_code, SANE_Auth_Callback __sane_un DBG (5, "sane_init: config file line %3d: ignoring comment line\n", linenumber); - free (word); continue; } @@ -1599,6 +1600,8 @@ sane_init (SANE_Int * __sane_unused__ version_code, SANE_Auth_Callback __sane_un DBG (3, "sane-init: I don't know how to handle option `%s'\n", word); } /* while */ + if (word) + free (word); fclose (fp); } /* if */ else |