compression: Fix nullpointer deref
When the creation of a new compression entity fails, an error
message is created, this error message contains printf with
a dereferentiation of the compression entity, that is clearly
NULL at that point. This commit corrects that.
Change-Id: I87371ade0ccd6a93b446f2013c1747f486739518
diff --git a/openbsc/src/gprs/gprs_sndcp_comp.c b/openbsc/src/gprs/gprs_sndcp_comp.c
index 1591f80..a12c39a 100644
--- a/openbsc/src/gprs/gprs_sndcp_comp.c
+++ b/openbsc/src/gprs/gprs_sndcp_comp.c
@@ -107,13 +107,14 @@
}
}
- /* Display info message */
+ /* Bail on failure */
if (comp_entity == NULL) {
LOGP(DSNDCP, LOGL_ERROR,
- "Compression entity (%d) creation failed!\n",
- comp_entity->entity);
+ "Compression entity creation failed!\n");
return NULL;
}
+
+ /* Display info message */
if (comp_entity->compclass == SNDCP_XID_PROTOCOL_COMPRESSION) {
LOGP(DSNDCP, LOGL_INFO,
"New header compression entity (%d) created.\n",