From 0354afb2b7cbe4ffa1536bb0b9c3026a2b33c646 Mon Sep 17 00:00:00 2001 From: Pradana AUMARS Date: Tue, 29 Jun 2021 23:37:41 +0200 Subject: [PATCH] Fix _priv->fp malloc & strcpy --- src/easycsv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/easycsv.c b/src/easycsv.c index 893def5..227c00f 100644 --- a/src/easycsv.c +++ b/src/easycsv.c @@ -728,9 +728,9 @@ _easycsv_priv_init(const char *fp, size_t stfp = strlen(fp); /* Allocate memory for char* */ - // priv->fp = malloc(stfp + 1); // + 1 for null + _priv->fp = malloc(stfp + 1); // + 1 for null - // strncpy(_priv->fp, fp, stfp); + strcpy(_priv->fp, fp); /* Calculate rows and cols if file exists */ if (access(_priv->fp, F_OK) == 0) {