Commit e435c70d authored by jan.koester's avatar jan.koester
Browse files

test

parent 120ee357
Loading
Loading
Loading
Loading
+19 −2
Changes for plugins/media/redis.cpp: 19 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -52,6 +52,18 @@ blogi::RedisStore::RedisStore(const char *host,int port,const char *password,int
        if(password){
            _RedisPassword=password;
            redisReply *rep=(redisReply*)redisCommand(_RedisCTX[i],"AUTH %s", password);
            if (rep == nullptr) {
                 libhttppp::HTTPException exp;
                 exp[libhttppp::HTTPException::Error] << "media plugin err: AUTH command failed: " << _RedisCTX[i]->errstr;
                 throw exp;
            }

            if (rep->type == REDIS_REPLY_ERROR) {
                libhttppp::HTTPException exp;
                exp[libhttppp::HTTPException::Error] << "media plugin err: Redis AUTH failed: " << rep->str;
                freeReplyObject(rep);
                throw exp;
            }
            freeReplyObject(rep);
        }

@@ -74,16 +86,21 @@ size_t blogi::RedisStore::getSize(int tid,const char* key){

        redisReply *rep=(redisReply*)redisCommand(_RedisCTX[tid],"STRLEN %s",key);

        size_t ret = 0; // Initialize return value

       if(!rep || rep->type != REDIS_REPLY_INTEGER){
           // Check if rep is not NULL before calling freeReplyObject on it
           if (rep) {
               freeReplyObject(rep);
           }
           libhttppp::HTTPException e;
           e[libhttppp::HTTPException::Error] << "media plugin err: wrong redis reply in getsize !";
           throw e;
       }

        size_t ret = rep->integer;
        ret = rep->integer;

        freeReplyObject(rep);
        freeReplyObject(rep); // <-- Correct location: free the object before returning

        return ret;
}
+2 −2
Changes for src/plugin.cpp: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -185,10 +185,10 @@ void blogi::Plugin::loadPlugins(const char *path, PluginArgs *args){
                        ldplg->ins=plg;

                        if(_lastPlugin){
                            _lastPlugin->next.swap(ldplg);
                            _lastPlugin->next=std::move(ldplg);
                            _lastPlugin = _lastPlugin->next.get();
                        }else{
                            _firstPlugin.swap(ldplg);
                            _firstPlugin=std::move(ldplg);
                            _lastPlugin = _firstPlugin.get();
                        }
                    }
+2 −2

File changed.

Contains only whitespace changes.