Skip to content

Commit

Permalink
Merge pull request #38 from u130b8/fix-realloc
Browse files Browse the repository at this point in the history
update pGroup after realloc
  • Loading branch information
freedom7341 authored Oct 13, 2023
2 parents c5c5d6d + 59f7eb7 commit f718eb4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion progmgr/group.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,11 @@ PITEM CreateItem(_In_ HWND hWndGroup, _In_ PITEM pi)
if (_msize(pGroup) != CalculateGroupMemory(pGroup, 1))
{
// if we reallocate memory then send the new pointer in
if (realloc(pGroup, CalculateGroupMemory(pGroup, 1)) != NULL)
PGROUP pNewGroup = realloc(pGroup, CalculateGroupMemory(pGroup, 1));
if (pNewGroup != NULL) {
pGroup = pNewGroup;
SetWindowLongPtr(hWndGroup, GWLP_USERDATA, (LONG_PTR)pGroup);
}
}

// add the item
Expand Down

0 comments on commit f718eb4

Please sign in to comment.