I have been using valgrind to debug my program (the program functions fine, just perfecting it) and it has returned one invalid pointer warning that I am having a difficult time fixing, so I was just wondering if someone could point me in the right direction? will post both the error valgrind gave me as well as the line (and a few that precede it) that valgrind is pointing to, thanks!
==9437== Invalid read of size 1
==9437== at 0x4C25812: __GI_strlen (mc_replace_strmem.c:284)
==9437== by 0x400F67: main (exec_deathinfo_c.c:95)
==9437== Address 0x0 is not stack'd, malloc'd or (recently) free'd
char *name;
char *filename;
name = getenv("MCEXEC_PLAYERNAME");
filename = malloc(sizeof "/home/minecraft/freedonia/playerdata/deathlog-.txt" - 1 + strlen(name) + 1);
suggests that
returned
NULL.