mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 23:08:40 +02:00
Call globfree to free memory used by glob.
This commit is contained in:
@@ -527,10 +527,12 @@ static int SetupGlobChain(char const *dirname, IncludeStruct *i)
|
|||||||
DBufFree(&pattern);
|
DBufFree(&pattern);
|
||||||
|
|
||||||
if (r == GLOB_NOMATCH) {
|
if (r == GLOB_NOMATCH) {
|
||||||
|
globfree(&glob_buf);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r != 0) {
|
if (r != 0) {
|
||||||
|
globfree(&glob_buf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -538,6 +540,7 @@ static int SetupGlobChain(char const *dirname, IncludeStruct *i)
|
|||||||
for (r=glob_buf.gl_pathc-1; r>=0; r--) {
|
for (r=glob_buf.gl_pathc-1; r>=0; r--) {
|
||||||
FilenameChain *ch = malloc(sizeof(FilenameChain));
|
FilenameChain *ch = malloc(sizeof(FilenameChain));
|
||||||
if (!ch) {
|
if (!ch) {
|
||||||
|
globfree(&glob_buf);
|
||||||
FreeChain(i->chain);
|
FreeChain(i->chain);
|
||||||
i->chain = NULL;
|
i->chain = NULL;
|
||||||
return E_NO_MEM;
|
return E_NO_MEM;
|
||||||
@@ -547,6 +550,7 @@ static int SetupGlobChain(char const *dirname, IncludeStruct *i)
|
|||||||
readable by us */
|
readable by us */
|
||||||
ch->filename = StrDup(glob_buf.gl_pathv[r]);
|
ch->filename = StrDup(glob_buf.gl_pathv[r]);
|
||||||
if (!ch->filename) {
|
if (!ch->filename) {
|
||||||
|
globfree(&glob_buf);
|
||||||
FreeChain(i->chain);
|
FreeChain(i->chain);
|
||||||
i->chain = NULL;
|
i->chain = NULL;
|
||||||
free(ch);
|
free(ch);
|
||||||
@@ -559,6 +563,7 @@ static int SetupGlobChain(char const *dirname, IncludeStruct *i)
|
|||||||
dc->chain = i->chain;
|
dc->chain = i->chain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globfree(&glob_buf);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user