#0 nsd/filter.c:163: error: Null Dereference pointer `servPtr` last assigned on line 153 could be null and is dereferenced by call to `FilterLock()` at line 163, column 5. nsd/filter.c:141:1: start of procedure Ns_RegisterFilter() 139. *---------------------------------------------------------------------- 140. */ 141. void * ^ 142. Ns_RegisterFilter(const char *server, const char *method, const char *url, 143. Ns_FilterProc *proc, Ns_FilterType when, void *arg, bool first) nsd/filter.c:148:5: 146. Filter *fPtr; 147. 148. NS_NONNULL_ASSERT(server != NULL); ^ 149. NS_NONNULL_ASSERT(method != NULL); 150. NS_NONNULL_ASSERT(url != NULL); nsd/filter.c:149:5: 147. 148. NS_NONNULL_ASSERT(server != NULL); 149. NS_NONNULL_ASSERT(method != NULL); ^ 150. NS_NONNULL_ASSERT(url != NULL); 151. NS_NONNULL_ASSERT(proc != NULL); nsd/filter.c:150:5: 148. NS_NONNULL_ASSERT(server != NULL); 149. NS_NONNULL_ASSERT(method != NULL); 150. NS_NONNULL_ASSERT(url != NULL); ^ 151. NS_NONNULL_ASSERT(proc != NULL); 152. nsd/filter.c:151:5: 149. NS_NONNULL_ASSERT(method != NULL); 150. NS_NONNULL_ASSERT(url != NULL); 151. NS_NONNULL_ASSERT(proc != NULL); ^ 152. 153. servPtr = NsGetServer(server); nsd/filter.c:153:5: 151. NS_NONNULL_ASSERT(proc != NULL); 152. 153. servPtr = NsGetServer(server); ^ 154. assert(servPtr != NULL); 155. nsd/server.c:82:1: start of procedure NsGetServer() 80. */ 81. 82. NsServer * ^ 83. NsGetServer(const char *server) 84. { nsd/server.c:85:5: 83. NsGetServer(const char *server) 84. { 85. NsServer *result = NULL; ^ 86. 87. if (server != NULL) { nsd/server.c:87:9: Taking true branch 85. NsServer *result = NULL; 86. 87. if (server != NULL) { ^ 88. const Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&nsconf.servertable, server); 89. nsd/server.c:88:9: Skipping __function_pointer__(): unresolved function pointer 86. 87. if (server != NULL) { 88. const Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&nsconf.servertable, server); ^ 89. 90. if (hPtr != NULL) { nsd/server.c:90:13: Taking false branch 88. const Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&nsconf.servertable, server); 89. 90. if (hPtr != NULL) { ^ 91. result = Tcl_GetHashValue(hPtr); 92. } nsd/server.c:95:5: 93. } 94. 95. return result; ^ 96. } 97. nsd/server.c:96:1: return from a call to NsGetServer 94. 95. return result; 96. } ^ 97. 98. nsd/filter.c:154:5: 152. 153. servPtr = NsGetServer(server); 154. assert(servPtr != NULL); ^ 155. 156. fPtr = ns_malloc(sizeof(Filter)); nsd/filter.c:156:5: 154. assert(servPtr != NULL); 155. 156. fPtr = ns_malloc(sizeof(Filter)); ^ 157. fPtr->proc = proc; 158. fPtr->method = ns_strdup(method); nsthread/memory.c:72:1: start of procedure ns_malloc() 70. return result; 71. } 72. void *ns_malloc(size_t size) { ^ 73. void *result; 74. #ifdef NS_VERBOSE_MALLOC nsthread/memory.c:83:5: 81. * in general, that a malloc() result of NULL means out of memory. 82. */ 83. result = malloc(size); ^ 84. /*if (size == 0u) { 85. fprintf(stderr, "ZERO ns_malloc size=%lu ptr %p\n", size, result); nsthread/memory.c:87:9: Condition is false 85. fprintf(stderr, "ZERO ns_malloc size=%lu ptr %p\n", size, result); 86. }*/ 87. if (unlikely(result == NULL && size > 0u)) { ^ 88. fprintf(stderr, "Fatal: failed to allocate %" PRIuz " bytes.\n", size); 89. abort(); nsthread/memory.c:87:9: Taking false branch 85. fprintf(stderr, "ZERO ns_malloc size=%lu ptr %p\n", size, result); 86. }*/ 87. if (unlikely(result == NULL && size > 0u)) { ^ 88. fprintf(stderr, "Fatal: failed to allocate %" PRIuz " bytes.\n", size); 89. abort(); nsthread/memory.c:91:5: 89. abort(); 90. } 91. return result; ^ 92. } 93. void ns_free(void *ptr) { nsthread/memory.c:92:1: return from a call to ns_malloc 90. } 91. return result; 92. } ^ 93. void ns_free(void *ptr) { 94. free(ptr); nsd/filter.c:157:5: 155. 156. fPtr = ns_malloc(sizeof(Filter)); 157. fPtr->proc = proc; ^ 158. fPtr->method = ns_strdup(method); 159. fPtr->url = ns_strdup(url); nsd/filter.c:158:5: 156. fPtr = ns_malloc(sizeof(Filter)); 157. fPtr->proc = proc; 158. fPtr->method = ns_strdup(method); ^ 159. fPtr->url = ns_strdup(url); 160. fPtr->when = when; nsthread/memory.c:174:1: start of procedure ns_strdup() 172. } 173. 174. char * ^ 175. ns_strdup(const char *old) 176. { nsthread/memory.c:180:5: 178. char *p; 179. 180. NS_NONNULL_ASSERT(old != NULL); ^ 181. 182. length = strlen(old) + 1u; nsthread/memory.c:182:5: 180. NS_NONNULL_ASSERT(old != NULL); 181. 182. length = strlen(old) + 1u; ^ 183. p = ns_malloc(length); 184. if (p != NULL) { nsthread/memory.c:183:5: 181. 182. length = strlen(old) + 1u; 183. p = ns_malloc(length); ^ 184. if (p != NULL) { 185. memcpy(p, old, length); nsthread/memory.c:72:1: start of procedure ns_malloc() 70. return result; 71. } 72. void *ns_malloc(size_t size) { ^ 73. void *result; 74. #ifdef NS_VERBOSE_MALLOC nsthread/memory.c:83:5: 81. * in general, that a malloc() result of NULL means out of memory. 82. */ 83. result = malloc(size); ^ 84. /*if (size == 0u) { 85. fprintf(stderr, "ZERO ns_malloc size=%lu ptr %p\n", size, result); nsthread/memory.c:87:9: Condition is false 85. fprintf(stderr, "ZERO ns_malloc size=%lu ptr %p\n", size, result); 86. }*/ 87. if (unlikely(result == NULL && size > 0u)) { ^ 88. fprintf(stderr, "Fatal: failed to allocate %" PRIuz " bytes.\n", size); 89. abort(); nsthread/memory.c:87:9: Taking false branch 85. fprintf(stderr, "ZERO ns_malloc size=%lu ptr %p\n", size, result); 86. }*/ 87. if (unlikely(result == NULL && size > 0u)) { ^ 88. fprintf(stderr, "Fatal: failed to allocate %" PRIuz " bytes.\n", size); 89. abort(); nsthread/memory.c:91:5: 89. abort(); 90. } 91. return result; ^ 92. } 93. void ns_free(void *ptr) { nsthread/memory.c:92:1: return from a call to ns_malloc 90. } 91. return result; 92. } ^ 93. void ns_free(void *ptr) { 94. free(ptr); nsthread/memory.c:184:9: Taking true branch 182. length = strlen(old) + 1u; 183. p = ns_malloc(length); 184. if (p != NULL) { ^ 185. memcpy(p, old, length); 186. } else { nsthread/memory.c:185:9: 183. p = ns_malloc(length); 184. if (p != NULL) { 185. memcpy(p, old, length); ^ 186. } else { 187. #if defined(ENOMEM) nsthread/memory.c:192:5: 190. } 191. 192. return p; ^ 193. } 194. nsthread/memory.c:193:1: return from a call to ns_strdup 191. 192. return p; 193. } ^ 194. 195. nsd/filter.c:159:5: 157. fPtr->proc = proc; 158. fPtr->method = ns_strdup(method); 159. fPtr->url = ns_strdup(url); ^ 160. fPtr->when = when; 161. fPtr->arg = arg; nsthread/memory.c:174:1: start of procedure ns_strdup() 172. } 173. 174. char * ^ 175. ns_strdup(const char *old) 176. { nsthread/memory.c:180:5: 178. char *p; 179. 180. NS_NONNULL_ASSERT(old != NULL); ^ 181. 182. length = strlen(old) + 1u; nsthread/memory.c:182:5: 180. NS_NONNULL_ASSERT(old != NULL); 181. 182. length = strlen(old) + 1u; ^ 183. p = ns_malloc(length); 184. if (p != NULL) { nsthread/memory.c:183:5: 181. 182. length = strlen(old) + 1u; 183. p = ns_malloc(length); ^ 184. if (p != NULL) { 185. memcpy(p, old, length); nsthread/memory.c:72:1: start of procedure ns_malloc() 70. return result; 71. } 72. void *ns_malloc(size_t size) { ^ 73. void *result; 74. #ifdef NS_VERBOSE_MALLOC nsthread/memory.c:83:5: 81. * in general, that a malloc() result of NULL means out of memory. 82. */ 83. result = malloc(size); ^ 84. /*if (size == 0u) { 85. fprintf(stderr, "ZERO ns_malloc size=%lu ptr %p\n", size, result); nsthread/memory.c:87:9: Condition is false 85. fprintf(stderr, "ZERO ns_malloc size=%lu ptr %p\n", size, result); 86. }*/ 87. if (unlikely(result == NULL && size > 0u)) { ^ 88. fprintf(stderr, "Fatal: failed to allocate %" PRIuz " bytes.\n", size); 89. abort(); nsthread/memory.c:87:9: Taking false branch 85. fprintf(stderr, "ZERO ns_malloc size=%lu ptr %p\n", size, result); 86. }*/ 87. if (unlikely(result == NULL && size > 0u)) { ^ 88. fprintf(stderr, "Fatal: failed to allocate %" PRIuz " bytes.\n", size); 89. abort(); nsthread/memory.c:91:5: 89. abort(); 90. } 91. return result; ^ 92. } 93. void ns_free(void *ptr) { nsthread/memory.c:92:1: return from a call to ns_malloc 90. } 91. return result; 92. } ^ 93. void ns_free(void *ptr) { 94. free(ptr); nsthread/memory.c:184:9: Taking true branch 182. length = strlen(old) + 1u; 183. p = ns_malloc(length); 184. if (p != NULL) { ^ 185. memcpy(p, old, length); 186. } else { nsthread/memory.c:185:9: 183. p = ns_malloc(length); 184. if (p != NULL) { 185. memcpy(p, old, length); ^ 186. } else { 187. #if defined(ENOMEM) nsthread/memory.c:192:5: 190. } 191. 192. return p; ^ 193. } 194. nsthread/memory.c:193:1: return from a call to ns_strdup 191. 192. return p; 193. } ^ 194. 195. nsd/filter.c:160:5: 158. fPtr->method = ns_strdup(method); 159. fPtr->url = ns_strdup(url); 160. fPtr->when = when; ^ 161. fPtr->arg = arg; 162. nsd/filter.c:161:5: 159. fPtr->url = ns_strdup(url); 160. fPtr->when = when; 161. fPtr->arg = arg; ^ 162. 163. FilterLock(servPtr, NS_WRITE); nsd/filter.c:163:5: 161. fPtr->arg = arg; 162. 163. FilterLock(servPtr, NS_WRITE); ^ 164. if (first) { 165. /* nsd/filter.c:89:1: start of procedure FilterLock() 87. */ 88. 89. static void ^ 90. FilterLock(NsServer *servPtr, NS_RW rw) { 91. if (servPtr->filter.rwlocks) { nsd/filter.c:91:9: Taking false branch 89. static void 90. FilterLock(NsServer *servPtr, NS_RW rw) { 91. if (servPtr->filter.rwlocks) { ^ 92. if (rw == NS_READ) { 93. Ns_RWLockRdLock(&servPtr->filter.lock.rwlock);