Author: Stan Eisenstat
Subject: Re: [Cs323] argv[] in struct
Date: Friday, 25 Sep 2020, 12:03:35
> Message Posted By: Unknown > > Are we supposed to realloc memory for argv in the CMD structs in order to > store a given argument. When I try using FreeCMD after doing so, it says > that the block I reallocated is not being free'd correctly and thus is > giving me a valgrind error. mallocCMD() allocates storage for an argument list with no arguments, just the NULL pointer in argv[argc]. Thus you must realloc() space for each argument. Since I need to see your code to diagnose the error, you will have to contact me directly rather than via the newsgroup. --Stan-PREV INDEX NEXT