@@ -197,14 +197,13 @@ PHP_FUNCTION(socket_sendmsg)
197197 res = sendmsg (php_sock -> bsd_socket , msghdr , (int )flags );
198198
199199 if (res != -1 ) {
200- zend_llist_destroy (allocations );
201- efree (allocations );
202-
203- RETURN_LONG ((zend_long )res );
200+ RETVAL_LONG ((zend_long )res );
204201 } else {
205202 PHP_SOCKET_ERROR (php_sock , "error in sendmsg" , errno );
206- RETURN_FALSE ;
203+ RETVAL_FALSE ;
207204 }
205+
206+ allocations_dispose (& allocations );
208207}
209208
210209PHP_FUNCTION (socket_recvmsg )
@@ -254,7 +253,6 @@ PHP_FUNCTION(socket_recvmsg)
254253
255254 /* we don;t need msghdr anymore; free it */
256255 msghdr = NULL ;
257- allocations_dispose (& allocations );
258256
259257 zval_ptr_dtor (zmsg );
260258 if (!err .has_error ) {
@@ -265,14 +263,15 @@ PHP_FUNCTION(socket_recvmsg)
265263 /* no need to destroy/free zres -- it's NULL in this circumstance */
266264 assert (zres == NULL );
267265 }
266+ RETVAL_LONG ((zend_long )res );
268267 } else {
269268 SOCKETS_G (last_error ) = errno ;
270269 php_error_docref (NULL , E_WARNING , "error in recvmsg [%d]: %s" ,
271270 errno , sockets_strerror (errno ));
272- RETURN_FALSE ;
271+ RETVAL_FALSE ;
273272 }
274273
275- RETURN_LONG (( zend_long ) res );
274+ allocations_dispose ( & allocations );
276275}
277276
278277PHP_FUNCTION (socket_cmsg_space )
0 commit comments