*/
char* buf = glob->glob_buffer;
int litindex;
+ GlobCode res = GLOB_OK;
*amount = 1; /* default is one single string */
switch (*pattern) {
case '\0':
- return GLOB_OK; /* singular URL processed */
+ break; /* singular URL processed */
case '{':
/* process set pattern */
- return glob_set(glob, ++pattern, ++pos, amount);
+ res = glob_set(glob, ++pattern, ++pos, amount);
+ break;
case '[':
/* process range pattern */
- return glob_range(glob, ++pattern, ++pos, amount);
+ res= glob_range(glob, ++pattern, ++pos, amount);
+ break;
}
- return GLOB_ERROR; /* something got wrong */
+ if(GLOB_OK != res)
+ /* free that strdup'ed string again */
+ free(glob->literal[litindex]);
+
+ return res; /* something got wrong */
}
int glob_url(URLGlob** glob, char* url, int *urlnum, FILE *error)
appendlen=1;
break;
case UPTNumRange:
- sprintf(numbuf, "%0*d", pat.content.NumRange.padlength, pat.content.NumRange.ptr_n);
+ sprintf(numbuf, "%0*d",
+ pat.content.NumRange.padlength,
+ pat.content.NumRange.ptr_n);
appendthis = numbuf;
appendlen = (int)strlen(numbuf);
break;