Browse Source

MT#55283 check for allocation failure

Change-Id: I26ff3bf77500b3772060507fdcbee00002e50a2c
Warned-by: Coverity
pull/1907/head
Richard Fuchs 11 months ago
parent
commit
79005cd6da
1 changed files with 10 additions and 8 deletions
  1. +10
    -8
      lib/loglib.c

+ 10
- 8
lib/loglib.c View File

@ -181,14 +181,16 @@ void __vpilog(int prio, const char *prefix, const char *fmt, va_list ap) {
llep = g_hash_table_lookup(__log_limiter, &lle);
if (!llep || (now - llep->when) >= 15) {
llep = bencode_buffer_alloc(&__log_limiter_buffer, sizeof(*llep));
*llep = (__typeof(*llep)) {
.prefix = bencode_strdup(&__log_limiter_buffer, prefix),
.msg = bencode_strdup(&__log_limiter_buffer, msg),
.when = now,
};
g_hash_table_insert(__log_limiter, llep, llep);
__log_limiter_count++;
llep = NULL;
if (llep) {
*llep = (__typeof(*llep)) {
.prefix = bencode_strdup(&__log_limiter_buffer, prefix),
.msg = bencode_strdup(&__log_limiter_buffer, msg),
.when = now,
};
g_hash_table_insert(__log_limiter, llep, llep);
__log_limiter_count++;
llep = NULL;
}
}
if (llep)


Loading…
Cancel
Save