counters.c:1069:13: warning: Potential leak of memory pointed to by 'temp'
SCMutexUnlock(&sc_perf_op_ctx->pctmi_lock);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./threads.h:121:28: note: expanded from macro 'SCMutexUnlock'
^~~~~~~~~~~~~~~~~~~~
counters.c:1156:16: warning: Potential leak of memory pointed to by 'pca'
return NULL;
^~~~
/usr/include/clang/3.3/include/stddef.h:77:24: note: expanded from macro 'NULL'
^
2 warnings generated.
temp->size = 1;
temp->head = SCMalloc(sizeof(SCPerfContext **));
if (temp->head == NULL) {
+ SCFree(temp);
SCMutexUnlock(&sc_perf_op_ctx->pctmi_lock);
return 0;
}
temp->head[0] = pctx;
temp->tm_name = SCStrdup(tm_name);
if (unlikely(temp->tm_name == NULL)) {
+ SCFree(temp->head);
+ SCFree(temp);
SCMutexUnlock(&sc_perf_op_ctx->pctmi_lock);
return 0;
}
return NULL;
memset(pca, 0, sizeof(SCPerfCounterArray));
- if ( (pca->head = SCMalloc(sizeof(SCPCAElem) * (e_id - s_id + 2))) == NULL)
+ if ( (pca->head = SCMalloc(sizeof(SCPCAElem) * (e_id - s_id + 2))) == NULL) {
+ SCFree(pca);
return NULL;
+ }
memset(pca->head, 0, sizeof(SCPCAElem) * (e_id - s_id + 2));
pc = pctx->head;