]> www.wagner.pp.ru Git - oss/catdoc.git/blobdiff - src/fileutil.c
Fix resource leaks found by cppcheck
[oss/catdoc.git] / src / fileutil.c
index ce616c2ea112d170894a7d95dbf7679d00437e1c..5ae039f5cd603eb9f57b5338266af4c051b227d8 100644 (file)
@@ -111,6 +111,8 @@ int check_charset(char **filename,const char *charset) {
                        *filename=strdup(charset);
                        free(tmppath);
                        return 1;
+               } else {
+                       free(tmppath);
                }
        }
        return 0;
@@ -180,14 +182,16 @@ void list_charsets(void) {
        char *q;
        char path_buf[PATH_BUF_SIZE];
        char dir_sep[2]={DIR_SEP,0};
+       char **ptr;
 #ifdef __MSDOS__
        struct ffblk ffblock;
        int res,col;
 #else
        glob_t glob_buf;
        int count,glob_flags=GLOB_ERR;
+
+       memset(&glob_buf,0,sizeof(glob_t));
 #endif
-       char **ptr;
        for (p=charset_path;p;p=(q?(q+1):NULL)) {
                q=strchr(p,LIST_SEP);
                if (q) {