Skip to contentSkip to conversation

lib/decompress_unlzma: Do a NULL check for pointer

PATCH New Fabio Estevam 1 participant 1 message Aug 14, 2015 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/decompress_unlzma: Do a NULL check for pointer

From: Fabio Estevam <[email protected]>

Compare pointer-typed values to NULL rather than 0.

The semantic patch that makes this change is available in scripts/coccinelle/null/badzero.cocci.

---
 lib/decompress_unlzma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/decompress_unlzma.c +1 -1
index 0be83af..04d6813 100644
@@ -620,7 +620,7 @@ STATIC inline int INIT unlzma(unsigned char *buf, long in_len,
 
 	num_probs = LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp));
 	p = (uint16_t *) large_malloc(num_probs * sizeof(*p));
-	if (p == 0)
+	if (p == NULL)
 		goto exit_2;
 	num_probs = LZMA_LITERAL + (LZMA_LIT_SIZE << (lc + lp));
 	for (i = 0; i < num_probs; i++)
Signature · 1 line
1.9.1