forked from enlightenment/efl
cnp: Add safety check for NULL pointer from strdup().
Summary: It could make crash when strdup() is failed. CID - 329115 @fix Reviewers: raster, thiepha, woohyun, Hermet Differential Revision: https://phab.enlightenment.org/D2673
This commit is contained in:
parent
9fba74ea72
commit
61fe7e5f39
|
@ -1316,6 +1316,14 @@ _x11_text_converter(char *target, void *data, int size, void **data_ret, int *si
|
|||
(const char **)data_ret, NULL);
|
||||
if (!*data_ret) *data_ret = strdup("No file");
|
||||
else *data_ret = strdup(*data_ret);
|
||||
|
||||
if (!*data_ret)
|
||||
{
|
||||
ERR("Failed to allocate memory!");
|
||||
*size_ret = 0;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
*size_ret = strlen(*data_ret);
|
||||
}
|
||||
return EINA_TRUE;
|
||||
|
|
Loading…
Reference in New Issue