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 437b50d..a97a5a2 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 437b50d..a97a5a2 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);