From 5b0755ca685e2b1079ecd3fc7a2df78d1ac197c9 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Tue, 23 Apr 2019 12:34:32 +0200 Subject: [PATCH] slurp: don't special-case empty files, instead behave like strdup("") This allows the caller to call free(3) in any case. --- slurp.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/slurp.c b/slurp.c index fff8624..7dbf5ed 100644 --- a/slurp.c +++ b/slurp.c @@ -24,11 +24,6 @@ slurp(char *filename, char **bufo, off_t *leno) r = errno; goto out; } - if (st.st_size == 0) { - *bufo = ""; - *leno = 0; - return 0; - } *bufo = malloc(st.st_size + 1); if (!*bufo) { r = ENOMEM;