Skip to content

Commit

Permalink
Attempt to fix a warning on Travis-CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdm committed Sep 2, 2015
1 parent c1fd3ea commit 759112c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mosquitto.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ PHP_METHOD(Mosquitto_Client, __construct)
if (!object->client) {
char *message = php_mosquitto_strerror_wrapper(errno);
zend_throw_exception(mosquitto_ce_exception, message, 1 TSRMLS_CC);
#ifndef STRERROR_R_CHAR_P
efree(message);
#endif
}
}
/* }}} */
Expand Down Expand Up @@ -835,10 +837,10 @@ static int strerror_r(int errnum, char *buf, size_t buf_len)

PHP_MOSQUITTO_API char *php_mosquitto_strerror_wrapper(int err)
{
char *buf = ecalloc(256, sizeof(char));
#ifdef STRERROR_R_CHAR_P
return strerror_r(err, buf, 256);
#else
char *buf = ecalloc(256, sizeof(char));
if (!strerror_r(err, buf, 256)) {
return buf;
}
Expand Down

0 comments on commit 759112c

Please sign in to comment.