Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/azatoth/minidlna.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Maggard <jmaggard@users.sourceforce.net>2011-09-17 03:39:57 +0400
committerJustin Maggard <jmaggard@users.sourceforce.net>2011-09-17 03:39:57 +0400
commitb81ff08b0ce5b99768f04c17002005bad5e20c07 (patch)
tree4cba796c6de01aeb93251589bfe21fe5288cfcaa /options.c
parent44f26df01df3ad565be9b9aa7df918f4b2bbeb5e (diff)
* Add support for other operating systems (kFreeBSD, FreeBSD, and OSX for now).
* Switch to autoconf from genconfig.sh.
Diffstat (limited to 'options.c')
-rw-r--r--options.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/options.c b/options.c
index 11fa680..d36f948 100644
--- a/options.c
+++ b/options.c
@@ -76,7 +76,7 @@ readoptionsfile(const char * fname)
int i;
enum upnpconfigoptions id;
- if(!fname || (strlen(fname) == 0))
+ if(!fname || *fname == '\0')
return -1;
memset(buffer, 0, sizeof(buffer));
@@ -155,8 +155,17 @@ readoptionsfile(const char * fname)
}
else
{
- num_options += 1;
- ary_options = (struct option *) realloc(ary_options, num_options * sizeof(struct option));
+ num_options++;
+ t = realloc(ary_options, num_options * sizeof(struct option));
+ if(!t)
+ {
+ fprintf(stderr, "memory allocation error: %s=%s\n",
+ name, value);
+ num_options--;
+ continue;
+ }
+ else
+ ary_options = (struct option *)t;
ary_options[num_options-1].id = id;
strncpy(ary_options[num_options-1].value, value, MAX_OPTION_VALUE_LEN);