From c7a1de18bd5d1790ed3be2fc151a9e23a2c7f638 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Tue, 28 Jul 2015 21:28:34 +0200 Subject: sfeed_plain: xbasename, free memory after use --- sfeed_plain.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sfeed_plain.c b/sfeed_plain.c index 91a8454..9b5a793 100644 --- a/sfeed_plain.c +++ b/sfeed_plain.c @@ -15,11 +15,10 @@ printfeed(FILE *fp, const char *feedname) { char *fields[FieldLast]; time_t parsedtime; - int r; while(parseline(&line, &size, fields, FieldLast, '\t', fp) > 0) { - r = strtotime(fields[FieldUnixTimestamp], &parsedtime); - if(r != -1 && parsedtime >= comparetime) + if(strtotime(fields[FieldUnixTimestamp], &parsedtime) != -1 && + parsedtime >= comparetime) fputs(" N ", stdout); else fputs(" ", stdout); @@ -38,6 +37,7 @@ int main(int argc, char *argv[]) { FILE *fp; + char *name; int i; /* 1 day is old news */ @@ -49,7 +49,9 @@ main(int argc, char *argv[]) for(i = 1; i < argc; i++) { if(!(fp = fopen(argv[i], "r"))) err(1, "fopen: %s", argv[i]); - printfeed(fp, xbasename(argv[i])); + name = xbasename(argv[i]); + printfeed(fp, name); + free(name); if(ferror(fp)) err(1, "ferror: %s", argv[i]); fclose(fp); -- cgit v1.2.3