diff --git a/avconv_opt.c b/avconv_opt.c
index 86989d66f65eb7a8e5874e9ed128bb1b148d9979..e231f539d26b57af3bd44bc93a44826b8a540946 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -1196,9 +1196,9 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
                     }
                     ost->logfile = f;
                 } else {
-                    char  *logbuffer;
-                    size_t logbuffer_size;
-                    if (cmdutils_read_file(logfilename, &logbuffer, &logbuffer_size) < 0) {
+                    char  *logbuffer = read_file(logfilename);
+
+                    if (!logbuffer) {
                         av_log(NULL, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n",
                                logfilename);
                         exit_program(1);
diff --git a/cmdutils.c b/cmdutils.c
index bc22ef583952bbb37821c3a4d8d187bffc94bf94..e5cba98a6060b1f4f2448fcffb6ff729dee0b215 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -1396,61 +1396,6 @@ int read_yesno(void)
     return yesno;
 }
 
-int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
-{
-    int ret;
-    FILE *f = fopen(filename, "rb");
-
-    if (!f) {
-        av_log(NULL, AV_LOG_ERROR, "Cannot read file '%s': %s\n", filename,
-               strerror(errno));
-        return AVERROR(errno);
-    }
-
-    ret = fseek(f, 0, SEEK_END);
-    if (ret == -1) {
-        ret = AVERROR(errno);
-        goto out;
-    }
-
-    ret = ftell(f);
-    if (ret < 0) {
-        ret = AVERROR(errno);
-        goto out;
-    }
-    *size = ret;
-
-    ret = fseek(f, 0, SEEK_SET);
-    if (ret == -1) {
-        ret = AVERROR(errno);
-        goto out;
-    }
-
-    *bufptr = av_malloc(*size + 1);
-    if (!*bufptr) {
-        av_log(NULL, AV_LOG_ERROR, "Could not allocate file buffer\n");
-        ret = AVERROR(ENOMEM);
-        goto out;
-    }
-    ret = fread(*bufptr, 1, *size, f);
-    if (ret < *size) {
-        av_free(*bufptr);
-        if (ferror(f)) {
-            av_log(NULL, AV_LOG_ERROR, "Error while reading file '%s': %s\n",
-                   filename, strerror(errno));
-            ret = AVERROR(errno);
-        } else
-            ret = AVERROR_EOF;
-    } else {
-        ret = 0;
-        (*bufptr)[(*size)++] = '\0';
-    }
-
-out:
-    fclose(f);
-    return ret;
-}
-
 void init_pts_correction(PtsCorrectionContext *ctx)
 {
     ctx->num_faulty_pts = ctx->num_faulty_dts = 0;
diff --git a/cmdutils.h b/cmdutils.h
index d90ad4549dc2e38eda99304b005e7fe1e6fa25fb..45d98586fa58a568df9c41d3e2bc78cd9b3bbee4 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -460,18 +460,6 @@ int show_sample_fmts(void *optctx, const char *opt, const char *arg);
  */
 int read_yesno(void);
 
-/**
- * Read the file with name filename, and put its content in a newly
- * allocated 0-terminated buffer.
- *
- * @param filename file to read from
- * @param bufptr location where pointer to buffer is returned
- * @param size   location where size of buffer is returned
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR error code in case of failure.
- */
-int cmdutils_read_file(const char *filename, char **bufptr, size_t *size);
-
 typedef struct PtsCorrectionContext {
     int64_t num_faulty_pts; /// Number of incorrect PTS values so far
     int64_t num_faulty_dts; /// Number of incorrect DTS values so far