diff --git a/common/menu-entry.c b/common/menu-entry.c index 2bfec48..250c3da 100644 --- a/common/menu-entry.c +++ b/common/menu-entry.c @@ -494,8 +494,7 @@ bool menuEntryLoad(menuEntry_s* me, const char* name, bool shortcut) { strptr = getSlash(me->path); if (strptr[0] == '/') strptr++; int strptrLen = strlen(strptr); - snprintf(tempbuf, sizeof(tempbuf)-1, "%.*s.%.*s.star", (int)(strlen(me->path) - strptrLen), me->path, (int)strptrLen, strptr); - strcpy(me->starpath, tempbuf); + snprintf(me->starpath, sizeof(me->starpath)-1, "%.*s.%.*s.star", (int)(strlen(me->path) - strptrLen), me->path, (int)strptrLen, strptr); me->starred = fileExists(me->starpath); return true; diff --git a/common/menu-list.c b/common/menu-list.c index 2244578..61227bc 100644 --- a/common/menu-list.c +++ b/common/menu-list.c @@ -101,7 +101,10 @@ static void menuSort(void) { menuEntry_s** list = (menuEntry_s**)calloc(nEntries, sizeof(menuEntry_s*)); if(list == NULL) return; menuEntry_s** listStar = (menuEntry_s**)calloc(nEntries, sizeof(menuEntry_s*)); - if(listStar == NULL) return; + if(listStar == NULL) { + free(list); + return; + } menuEntry_s* p = m->firstEntry; for(i = 0; i < nEntries; ++i) { diff --git a/common/menu.c b/common/menu.c index 6ed8c29..19357f5 100644 --- a/common/menu.c +++ b/common/menu.c @@ -38,7 +38,7 @@ void toggleStarState(menuEntry_s* arg) { } else { if (!fileExists(me->starpath)) { FILE* f = fopen(me->starpath, "w"); - fclose(f); + if (f) fclose(f); } } me->starred = fileExists(me->starpath);