Unverified Commit 94fded4f authored by Ilya Shipitsin's avatar Ilya Shipitsin Committed by GitHub
Browse files

Code cleanup, resolve an issue identified by cppcheck (#4373)

[src/bitops.c:512] -> [src/bitops.c:507]: (warning) Either the condition 'if(o&&o->encoding==1)' is redundant or there is possible null pointer dereference: o.

This function has checks for `o` to be null or non-null, so it is odd that it accesses it first..
parent 61bb0441
...@@ -508,7 +508,7 @@ robj *lookupStringForBitCommand(client *c, uint64_t maxbit, int *created) { ...@@ -508,7 +508,7 @@ robj *lookupStringForBitCommand(client *c, uint64_t maxbit, int *created) {
* If the source object is NULL the function is guaranteed to return NULL * If the source object is NULL the function is guaranteed to return NULL
* and set 'len' to 0. */ * and set 'len' to 0. */
unsigned char *getObjectReadOnlyString(robj *o, long *len, char *llbuf) { unsigned char *getObjectReadOnlyString(robj *o, long *len, char *llbuf) {
serverAssert(o->type == OBJ_STRING); serverAssert(!o || o->type == OBJ_STRING);
unsigned char *p = NULL; unsigned char *p = NULL;
/* Set the 'p' pointer to the string, that can be just a stack allocated /* Set the 'p' pointer to the string, that can be just a stack allocated
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment