A couple of allocation were not calling virReportOOMError on allocation
errors
* src/util/hash.c: add the needed call in virHashCreate and
virHashAddOrUpdateEntry
#include "hash.h"
#include "memory.h"
+#define VIR_FROM_THIS VIR_FROM_NONE
+
#define MAX_HASH_LEN 8
/* #define DEBUG_GROW */
if (size <= 0)
size = 256;
- if (VIR_ALLOC(table) < 0)
+ if (VIR_ALLOC(table) < 0) {
+ virReportOOMError();
return NULL;
+ }
table->size = size;
table->nbElems = 0;
if (VIR_ALLOC_N(table->table, size) < 0) {
+ virReportOOMError();
VIR_FREE(table);
return NULL;
}
return (-1);
if (VIR_ALLOC_N(table->table, size) < 0) {
+ virReportOOMError();
table->table = oldtable;
return (-1);
}
if (insert == NULL) {
entry = &(table->table[key]);
} else {
- if (VIR_ALLOC(entry) < 0)
+ if (VIR_ALLOC(entry) < 0) {
+ virReportOOMError();
return (-1);
+ }
}
new_name = strdup(name);
if (new_name == NULL) {
+ virReportOOMError();
if (insert != NULL)
VIR_FREE(entry);
return (-1);