diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-07-28 21:28:34 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-07-28 21:28:34 +0200 |
commit | c7a1de18bd5d1790ed3be2fc151a9e23a2c7f638 (patch) | |
tree | 764d254375c178f68bad98d987f07bd7ed5ea775 | |
parent | b5c3d48091fb2856d768223deb42d3674edcc7b2 (diff) |
sfeed_plain: xbasename, free memory after use
-rw-r--r-- | sfeed_plain.c | 10 |
1 files 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); |