summaryrefslogtreecommitdiffstats
path: root/source/lib/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/lib/util.c')
-rw-r--r--source/lib/util.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source/lib/util.c b/source/lib/util.c
index fd1299701e7..db87cfefa59 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -157,20 +157,21 @@ char *get_numlist(char *p, uint32 **num, int *count)
int val;
if (num == NULL || count == NULL)
- {
return NULL;
- }
(*count) = 0;
(*num ) = NULL;
- while ((p = Atoic(p, &val, ":,")) != NULL && (*p) != ':')
- {
- (*num) = Realloc((*num), ((*count)+1) * sizeof(uint32));
- if ((*num) == NULL)
- {
+ while ((p = Atoic(p, &val, ":,")) != NULL && (*p) != ':') {
+ uint32 *tn;
+
+ tn = Realloc((*num), ((*count)+1) * sizeof(uint32));
+ if (tn == NULL) {
+ if (*num)
+ free(*num);
return NULL;
- }
+ } else
+ (*num) = tn;
(*num)[(*count)] = val;
(*count)++;
p++;