test malloc/calloc's return. Fix CID1436182

This commit is contained in:
Boris Faure 2020-11-11 23:08:22 +01:00
parent 7465f46a9f
commit c2cd0035e4
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
2 changed files with 13 additions and 5 deletions

View File

@ -401,9 +401,12 @@ cb_term_new(Evas_Object *termio_obj)
length = (strlen(path) + strlen(cwd) + strlen(template) - 3);
cmd = malloc(sizeof(char) * length);
snprintf(cmd, length, template, path, cwd);
ecore_exe_run(cmd, NULL);
free(cmd);
if (cmd)
{
snprintf(cmd, length, template, path, cwd);
ecore_exe_run(cmd, NULL);
free(cmd);
}
}
else
{

View File

@ -303,10 +303,10 @@ _rec_read_directorys(Background_Ctx *ctx, Eina_List *list,
item = calloc(1, sizeof(Background_Item));
if (item)
{
notify = calloc(1,
sizeof(Insert_Gen_Grid_Item_Notify));
item->path = eina_stringshare_add(path);
list = eina_list_append(list, item);
notify = calloc(1,
sizeof(Insert_Gen_Grid_Item_Notify));
if (notify)
{
//insert item to gengrid
@ -350,6 +350,11 @@ _refresh_directory(Background_Ctx *ctx, const char* data)
item_class->func.content_get = _grid_content_get;
item = calloc(1, sizeof(Background_Item));
if (!item)
{
elm_gengrid_item_class_free(item_class);
return;
}
ctx->background_list = eina_list_append(ctx->background_list, item);
//Insert None Item