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
This commit is contained in:
Philipp Maier 2017-01-23 15:36:37 +01:00 committed by Harald Welte
parent f6e51709fc
commit d0ef1ed78c
1 changed files with 4 additions and 3 deletions

View File

@ -107,13 +107,14 @@ static struct gprs_sndcp_comp *gprs_sndcp_comp_create(const void *ctx,
}
}
/* 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",