The realloc function does the malloc job. And it will only increase the size of the value pointer when necessary.
Best, Scuri Em seg, 3 de jun de 2019 às 22:29, Ranier VF <ranier_...@hotmail.com> escreveu: > Hi, > Sorry but can't undestand the logic. > iupmatex_clipboard.c > line 505, call function: > > value = iMatrixExStrCopyData(value, &value_max_size, data, value_len); > > iMatrixExStrCopyData, call memcpy with value without malloc? > > static char* iMatrixExStrCopyData(char* value, int *value_max_size, const > char* data, int value_len) > { > if (*value_max_size < value_len) /* if fail, memcpy destroy memory > pointer */ > { > *value_max_size = value_len+10; > value = realloc(value, *value_max_size); > } > memcpy(value, data, value_len); > value[value_len] = 0; > return value; > } > > Best regards, > Ranier Vilela > > _______________________________________________ > Iup-users mailing list > Iup-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/iup-users >
_______________________________________________ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users