summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2008-11-26 17:18:08 +0100
committerPatrick McHardy <kaber@trash.net>2008-11-26 17:18:08 +0100
commit0eee3009e7015b82a46b2eccad91f759d75ec4df (patch)
tree7aa58d6aa5aa62b10baec1a4d2f8b1507773b289
parent64f948b24407c3cf3d02476059a3f9fa0265cb3d (diff)
libiptc: guard chain index allocation for different malloc implementations
Some libc implementations such as µClibc return NULL on malloc(0). They are free to do that per C standard. Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signeed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r--libiptc/libiptc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
index 13e4c69f..544a5b29 100644
--- a/libiptc/libiptc.c
+++ b/libiptc/libiptc.c
@@ -503,7 +503,7 @@ static int iptcc_chain_index_alloc(struct xtc_handle *h)
array_elems, array_mem);
h->chain_index = malloc(array_mem);
- if (!h->chain_index) {
+ if (h->chain_index == NULL && array_mem > 0) {
h->chain_index_sz = 0;
return -ENOMEM;
}