@@ -192,14 +192,13 @@ PHP_FUNCTION(socket_sendmsg)
192192 res = sendmsg (php_sock -> bsd_socket , msghdr , (int )flags );
193193
194194 if (res != -1 ) {
195- zend_llist_destroy (allocations );
196- efree (allocations );
197-
198- RETURN_LONG ((zend_long )res );
195+ RETVAL_LONG ((zend_long )res );
199196 } else {
200197 PHP_SOCKET_ERROR (php_sock , "error in sendmsg" , errno );
201- RETURN_FALSE ;
198+ RETVAL_FALSE ;
202199 }
200+
201+ allocations_dispose (& allocations );
203202}
204203
205204PHP_FUNCTION (socket_recvmsg )
@@ -246,7 +245,6 @@ PHP_FUNCTION(socket_recvmsg)
246245
247246 /* we don;t need msghdr anymore; free it */
248247 msghdr = NULL ;
249- allocations_dispose (& allocations );
250248
251249 zval_ptr_dtor (zmsg );
252250 if (!err .has_error ) {
@@ -257,14 +255,15 @@ PHP_FUNCTION(socket_recvmsg)
257255 /* no need to destroy/free zres -- it's NULL in this circumstance */
258256 assert (zres == NULL );
259257 }
258+ RETVAL_LONG ((zend_long )res );
260259 } else {
261260 SOCKETS_G (last_error ) = errno ;
262261 php_error_docref (NULL , E_WARNING , "Error in recvmsg [%d]: %s" ,
263262 errno , sockets_strerror (errno ));
264- RETURN_FALSE ;
263+ RETVAL_FALSE ;
265264 }
266265
267- RETURN_LONG (( zend_long ) res );
266+ allocations_dispose ( & allocations );
268267}
269268
270269PHP_FUNCTION (socket_cmsg_space )
0 commit comments