infosec-intern / lcthw

Some code I would like to save throughout Learn C The Hard Way

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Double freeing current_pattern in search_files()

infosec-intern opened this issue · comments

142: current_pattern = patterns[i];
194:	free(current_pattern);

Results in a double free error back in main on line 240

Need to convert line 142 to strncpy(current_pattern, patterns[i]); or skip malloc() and free() for current_pattern altogether

Fixed in 6e19f79 by skipping malloc() and free() for current_pattern and current_file