diff --git a/services/begetctl/misc_daemon.cpp b/services/begetctl/misc_daemon.cpp index 201357322a8bce44e54fafbc5edc1c513766ee77..77c7485c8b438c77b1e0ae2c5143e3c10d02e1a1 100755 --- a/services/begetctl/misc_daemon.cpp +++ b/services/begetctl/misc_daemon.cpp @@ -55,18 +55,16 @@ static void ClearLogo(int fd) } static void WriteLogoContent(int fd, const std::string &logoPath, uint32_t size) -{ +{ + if (size == 0 || size > MAX_LOGO_SIZE) { + BSH_LOGE("logo size is invalid!"); + return; + } FILE *rgbFile = fopen(logoPath.c_str(), "rb"); if (rgbFile == nullptr) { std::cout << "cannot find pic file\n"; return; } - - if (size <= 0 || size > MAX_LOGO_SIZE) { - BSH_LOGE("logo size is invalid!"); - return; - } - char *buffer = reinterpret_cast(malloc(size)); if (buffer == nullptr) { (void)fclose(rgbFile);