bWolfie
I'm the man
I made this command to retrieve all of an item from storage.
This line char *item_name =(char *)aMalloc(ITEM_NAME_LENGTH*sizeof(char)); causes memory leak. How to fix it?
This line char *item_name =(char *)aMalloc(ITEM_NAME_LENGTH*sizeof(char)); causes memory leak. How to fix it?
Code:
struct item_data *i_data = itemdb->exists(nameid);
if (i_data == NULL) {
clif->message(fd, "Invalid Item ID.");
return false;
}
char *item_name =(char *)aMalloc(ITEM_NAME_LENGTH*sizeof(char));
memcpy(item_name, i_data->jname, ITEM_NAME_LENGTH);
char output[100];
sprintf(output, "Retrieved %d '%s' from storage.", i, item_name);