Moved around cleanup code, minor fixes, version bump

This commit is contained in:
farfalleflickan 2024-09-24 12:15:44 +02:00
parent a3b57f7033
commit 87445fd8a4
3 changed files with 7 additions and 13 deletions

View File

@ -287,7 +287,7 @@ progConfig *getConfig(char *srcPath) {
if (setrlimit(RLIMIT_NOFILE, &(options->newLim))==-1){ if (setrlimit(RLIMIT_NOFILE, &(options->newLim))==-1){
confCleanup(options); confCleanup(options);
fatalError_abort("getConfig error", "could not set new fileLimit, error: %s\n", errno, strerror(errno)); fatalError_abort("getConfig error", "could not set new fileLimit, error: %s\n", strerror(errno));
} }
} }
} }

View File

@ -17,7 +17,7 @@
#include "main.h" #include "main.h"
#define REPO_URL "https://github.com/farfalleflickan/cmyflix" #define REPO_URL "https://github.com/farfalleflickan/cmyflix"
#define VERSION_STRING "0.22" #define VERSION_STRING "0.23"
// GLOBAL VARIABLES // GLOBAL VARIABLES
FILE *LOGFILE=NULL; FILE *LOGFILE=NULL;
@ -78,9 +78,6 @@ void checkUpdate() {
resetSTDColors(); resetSTDColors();
FILE *cmdRet=popen(cmdStr, "r"); FILE *cmdRet=popen(cmdStr, "r");
if (cmdRet==NULL) { if (cmdRet==NULL) {
if (pclose(cmdRet)!=0) {
printError("cmyflix", false, HRED, "%s\n", strerror(errno));
}
tryFree(cmdStr); tryFree(cmdStr);
fatalError_exit("checkUpdate", "something went wrong while trying to check for an update, errno is: %s\n", strerror(errno)); fatalError_exit("checkUpdate", "something went wrong while trying to check for an update, errno is: %s\n", strerror(errno));
} else { } else {
@ -215,9 +212,6 @@ void copyExtras(progConfig *conf, progFlags runFlags, char *htmlFolder, char *de
resetSTDColors(); resetSTDColors();
FILE *cmdRet=popen(cmdStr, "r"); FILE *cmdRet=popen(cmdStr, "r");
if (cmdRet==NULL) { if (cmdRet==NULL) {
if (pclose(cmdRet)!=0) {
printError("cmyflix", false, HRED, "%s\n", strerror(errno));
}
tryFree(cmdStr); tryFree(cmdStr);
fatalError_exit("cmyflix error", "something went wrong while trying to copy HTML resources from '%s' to '%s';\n", extPath, tempStr2); fatalError_exit("cmyflix error", "something went wrong while trying to copy HTML resources from '%s' to '%s';\n", extPath, tempStr2);
} else { } else {

View File

@ -791,10 +791,10 @@ char *getPoster(const char *posterURL, progConfig *conf, int prefImgWidth, doubl
} }
cJSON_Delete(imgStr); cJSON_Delete(imgStr);
} }
}
cJSON_Delete(width); cJSON_Delete(width);
cJSON_Delete(ratio); cJSON_Delete(ratio);
cJSON_Delete(lang); cJSON_Delete(lang);
}
} else { } else {
printError("getPoster warning", true, HYEL, "request error, URL: '%s';\nitem==NULL - json_posters was:\n", posterURL); printError("getPoster warning", true, HYEL, "request error, URL: '%s';\nitem==NULL - json_posters was:\n", posterURL);
char *tempStr=cJSON_Print(json_posters); char *tempStr=cJSON_Print(json_posters);
@ -811,7 +811,6 @@ char *getPoster(const char *posterURL, progConfig *conf, int prefImgWidth, doubl
printError("", true, HYEL, "\nEND;\n"); printError("", true, HYEL, "\nEND;\n");
tryFree(tempStr); tryFree(tempStr);
} }
cJSON_Delete(json_posters);
} else { } else {
printError("getPoster warning", true, HYEL, "request error, URL: '%s';\njson_posters==NULL - json_root was:\n", posterURL); printError("getPoster warning", true, HYEL, "request error, URL: '%s';\njson_posters==NULL - json_root was:\n", posterURL);
char *tempStr=cJSON_Print(json_root); char *tempStr=cJSON_Print(json_root);
@ -819,10 +818,11 @@ char *getPoster(const char *posterURL, progConfig *conf, int prefImgWidth, doubl
printError("", true, HYEL, "\nEND;\n"); printError("", true, HYEL, "\nEND;\n");
tryFree(tempStr); tryFree(tempStr);
} }
cJSON_Delete(json_root); cJSON_Delete(json_posters);
} else { } else {
printError("getPoster warning", true, HYEL, "request error, URL: '%s';\njson_root==NULL\n", posterURL); printError("getPoster warning", true, HYEL, "request error, URL: '%s';\njson_root==NULL\n", posterURL);
} }
cJSON_Delete(json_root);
freeBlock(mem); freeBlock(mem);
return imgURL; return imgURL;
} }