bugfix: allocate correct object type

Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/net.c:178:19: warning: Result of 'calloc' is converted to a pointer of type 'permittedPeerWildcard_t', which is incompatible with sizeof operand type 'permittedPeers_t'
rsyslog-7.4.10/runtime/rsyslog.h:441:34: note: expanded from macro 'CHKmalloc'
Cast a value to make an analyzer happy

Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/net.c:725:34: warning: Result of 'malloc' is converted to a pointer of type 'struct sockaddr', which is incompatible with sizeof operand type 'struct sockaddr_in'
rsyslog-7.4.10/runtime/debug.h:146:20: note: expanded from macro 'MALLOC'
bugfix: plug a memleak in AddAllowedSender()

Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/net.c:771:2: warning: Potential leak of memory pointed to by 'allowIP.addr.NetAddr'
rsyslog-7.4.10/runtime/rsyslog.h:445:40: note: expanded from macro 'RETiRet'
bugfix: plug a memleak in addAllowedSenderLine()

Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/net.c:876: alloc_arg: "parsAddrWithBits(rsParsObj *, struct NetAddr **, int *)" allocates memory that is stored into "uIP".
rsyslog-7.4.10/parse.c:419:2: alloc_fn: Storage is returned from allocation function "calloc(size_t, size_t)".
rsyslog-7.4.10/parse.c:419:2: var_assign: Assigning: "*pIP" = "calloc(1UL, 16UL)".
rsyslog-7.4.10/runtime/net.c:882: noescape: Resource "uIP" is not freed or pointed-to in function "AddAllowedSender(struct AllowedSenders **, struct AllowedSenders **, struct NetAddr *, uint8_t)".
rsyslog-7.4.10/runtime/net.c:619:27: noescape: "AddAllowedSender(struct AllowedSenders **, struct AllowedSenders **, struct NetAddr *, uint8_t)" does not free or save its pointer parameter "iAllow".
rsyslog-7.4.10/runtime/net.c:890: leaked_storage: Variable "uIP" going out of scope leaks the storage it points to.
bugfix: plug a memleak in parsAddrWithBits()

Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/net.c:876: alloc_arg: "parsAddrWithBits(rsParsObj *, struct NetAddr **, int *)" allocates memory that is stored into "uIP".
rsyslog-7.4.10/parse.c:419:2: alloc_fn: Storage is returned from allocation function "calloc(size_t, size_t)".
rsyslog-7.4.10/parse.c:419:2: var_assign: Assigning: "*pIP" = "calloc(1UL, 16UL)".
rsyslog-7.4.10/runtime/net.c:880: leaked_storage: Variable "uIP" going out of scope leaks the storage it points to.
bugfix: use sockaddr_storage to store sockaddr_in6

Error: COMPILER_WARNING:
rsyslog-7.4.10/runtime/net.c: scope_hint: In function 'debugListenInfo'
rsyslog-7.4.10/runtime/net.c:1101: warning: dereferencing pointer 'ipv6' does break strict-aliasing rules
rsyslog-7.4.10/runtime/net.c:1100: note: initialized from here
bugfix: don't leak memory when realloc() fails

Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/net.c:1168:2: warning: Potential leak of memory pointed to by 'buf'
rsyslog-7.4.10/runtime/rsyslog.h:445:40: note: expanded from macro 'RETiRet'
bugfix: don't leak an open FD

Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/nsd_gtls.c:120: open_fn: Returning handle opened by function "open(char const *, int, ...)".
rsyslog-7.4.10/runtime/nsd_gtls.c:120: var_assign: Assigning: "fd" = handle returned from "open((char *)pszFile, 0)".
rsyslog-7.4.10/runtime/nsd_gtls.c:126: noescape: Resource "fd" is not freed or pointed-to in function "fstat(int, struct stat *)".
rsyslog-7.4.10/runtime/nsd_gtls.c:139: noescape: Resource "fd" is not freed or pointed-to in function "read(int, void *, size_t)".
rsyslog-7.4.10/runtime/nsd_gtls.c:154: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
bugfix: check return codes

Error: FORWARD_NULL (CWE-476):
rsyslog-7.4.10/runtime/prop.c:171: var_compare_op: Comparing "*ppThis" to null implies that "*ppThis" might be null.
rsyslog-7.4.10/runtime/prop.c:173: var_deref_model: Passing "ppThis" to function "CreateStringProp(prop_t **, uchar *, int)", which dereferences null "*ppThis".
rsyslog-7.4.10/runtime/prop.c:149:2: deref_parm_in_call: Function "SetString(prop_t *, uchar *, int)" dereferences "*ppThis".
rsyslog-7.4.10/runtime/prop.c:80:2: deref_parm: Directly dereferencing parameter "pThis".

Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/prop.c:80:5: warning: Access to field 'len' results in a dereference of a null pointer (loaded from variable 'pThis')
bugfix: check return value of malloc()

Error: NULL_RETURNS (CWE-476):
rsyslog-7.4.10/runtime/queue.c:2126: returned_null: Function "malloc(size_t)" returns null (checked 140 out of 168 times).
rsyslog-7.4.10/action.c:1197: example_checked: Example 1: "malloc(batchNumMsgs(pBatch) * 1UL)" has its value checked in "(active = malloc(batchNumMsgs(pBatch) * 1UL)) == NULL".
rsyslog-7.4.10/grammar/lexer.l:302: example_checked: Example 2: "malloc(40UL)" has its value checked in "(bs = malloc(40UL)) == NULL".
rsyslog-7.4.10/grammar/rainerscript.c:2483: example_checked: Example 3: "malloc(8UL)" has its value checked in "(ar->arr = malloc(8UL)) == NULL".
rsyslog-7.4.10/plugins/imklog/bsd.c:221: example_checked: Example 4: "malloc(1UL * (iMaxLine + 1))" has its value checked in "(pRcv = (uchar *)malloc(1UL * (iMaxLine + 1))) == NULL".
rsyslog-7.4.10/plugins/imuxsock/imuxsock.c:968: example_checked: Example 5: "malloc(1UL * (iMaxLine + 1))" has its value checked in "(pRcv = (uchar *)malloc(1UL * (iMaxLine + 1))) == NULL".
rsyslog-7.4.10/runtime/queue.c:2126: var_assigned: Assigning: "pThis->mut" = null return value from "malloc(size_t)".
rsyslog-7.4.10/runtime/queue.c:2127: dereference: Dereferencing a pointer that might be null "pThis->mut" when calling "pthread_mutex_init(pthread_mutex_t *, pthread_mutexattr_t const *)".
bugfix: always initialize an output parameter

Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/ratelimit.c:255:13: warning: The left operand of '!=' is a garbage value
don't allocate a 0B chunk of memory

Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/ruleset.c:220:9: warning: Call to 'malloc' has an allocation size of 0 bytes
bugfix: don't leak memory returned by newActive()

Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/ruleset.c:326: alloc_fn: Storage is returned from allocation function "newActive(batch_t *)".
rsyslog-7.4.10/runtime/ruleset.c:220:2: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
rsyslog-7.4.10/runtime/ruleset.c:220:2: return_alloc_fn: Directly returning storage allocated by "malloc(size_t)".
rsyslog-7.4.10/runtime/ruleset.c:326: var_assign: Assigning: "newAct" = storage returned from "newActive(pBatch)".
rsyslog-7.4.10/runtime/ruleset.c:362: leaked_storage: Variable "newAct" going out of scope leaks the storage it points to.

Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/ruleset.c:373: alloc_fn: Storage is returned from allocation function "newActive(batch_t *)".
rsyslog-7.4.10/runtime/ruleset.c:220:2: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
rsyslog-7.4.10/runtime/ruleset.c:220:2: return_alloc_fn: Directly returning storage allocated by "malloc(size_t)".
rsyslog-7.4.10/runtime/ruleset.c:373: var_assign: Assigning: "newAct" = storage returned from "newActive(pBatch)".
rsyslog-7.4.10/runtime/ruleset.c:376: leaked_storage: Variable "newAct" going out of scope leaks the storage it points to.
bugfix: don't leak memory returned by newActive()

Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/ruleset.c:506: alloc_fn: Storage is returned from allocation function "newActive(batch_t *)".
rsyslog-7.4.10/runtime/ruleset.c:220:2: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
rsyslog-7.4.10/runtime/ruleset.c:220:2: return_alloc_fn: Directly returning storage allocated by "malloc(size_t)".
rsyslog-7.4.10/runtime/ruleset.c:506: var_assign: Assigning: "thenAct" = storage returned from "newActive(pBatch)".
rsyslog-7.4.10/runtime/ruleset.c:509: leaked_storage: Variable "thenAct" going out of scope leaks the storage it points to.
bugfix: plug a memleak in rulesetProcessCnf()

Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/ruleset.c:984: alloc_arg: "rulesetConstruct(ruleset_t **)" allocates memory that is stored into "pRuleset".
rsyslog-7.4.10/runtime/ruleset.c:729:1: alloc_fn: Storage is returned from allocation function "calloc(size_t, size_t)".
rsyslog-7.4.10/runtime/ruleset.c:729:1: var_assign: Assigning: "pThis" = "calloc(1UL, 56UL)".
rsyslog-7.4.10/runtime/ruleset.c:729:1: noescape: Resource "pThis" is not freed or pointed-to in function "rulesetInitialize(ruleset_t *)".
rsyslog-7.4.10/runtime/ruleset.c:726:1: noescape: "rulesetInitialize(ruleset_t *)" does not free or save its pointer parameter "pThis".
rsyslog-7.4.10/runtime/ruleset.c:729:1: var_assign: Assigning: "*ppThis" = "pThis".
rsyslog-7.4.10/runtime/ruleset.c:985: noescape: Resource "pRuleset" is not freed or pointed-to in function "rulesetSetName(ruleset_t *, uchar *)".
rsyslog-7.4.10/runtime/ruleset.c:638:43: noescape: "rulesetSetName(ruleset_t *, uchar *)" does not free or save its pointer parameter "pThis".
rsyslog-7.4.10/runtime/ruleset.c:1011: leaked_storage: Variable "pRuleset" going out of scope leaks the storage it points to.