Fix malloc size

This commit is contained in:
Pradana AUMARS 2021-06-28 12:11:14 +02:00
parent f97f364681
commit 6199dc4a12

View File

@ -201,7 +201,7 @@ easycsv_init_errormsg(const char *fp,
csv->start = clock();
#endif
easycsv *csv = malloc(sizeof *csv);
easycsv *csv = malloc(sizeof(csv));
csv->mode = mode;
csv->_priv = _easycsv_priv_init(fp, mode, error);
@ -687,7 +687,7 @@ _easycsv_priv_init(const char *fp,
const EASYCSV_MODE mode,
const EASYCSV_ERRORMSG error)
{
_easycsv *_priv = malloc(sizeof *_priv);
_easycsv *_priv = malloc(sizeof(_easycsv));
memset(_priv, 0, sizeof(*_priv)); // set all members to NULL or 0
_priv->error = error;