Dont free everytime getline() is used, fix from Stefan Soucek
authorGlenn L McGrath <bug1@ihug.co.nz>
Sat, 22 Sep 2001 03:24:07 +0000 (03:24 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Sat, 22 Sep 2001 03:24:07 +0000 (03:24 -0000)
archival/dpkg.c
dpkg.c

index 437b50d3b7914e360976ce4d65e028b439757bae..a97a5a29fdfde3c19f1daa6d812c7ea060cf3e8c 100644 (file)
@@ -1042,11 +1042,10 @@ char **create_list(const char *filename)
                        *last_char = '\0';
                }
                file_list[count] = xstrdup(line);
-               free(line);
                count++;
-               length = 0;
        }
        fclose(list_stream);
+       free(line);
 
        if (count == 0) {
                return(NULL);
diff --git a/dpkg.c b/dpkg.c
index 437b50d3b7914e360976ce4d65e028b439757bae..a97a5a29fdfde3c19f1daa6d812c7ea060cf3e8c 100644 (file)
--- a/dpkg.c
+++ b/dpkg.c
@@ -1042,11 +1042,10 @@ char **create_list(const char *filename)
                        *last_char = '\0';
                }
                file_list[count] = xstrdup(line);
-               free(line);
                count++;
-               length = 0;
        }
        fclose(list_stream);
+       free(line);
 
        if (count == 0) {
                return(NULL);