jmuehlner commented on code in PR #462:
URL: https://github.com/apache/guacamole-server/pull/462#discussion_r1369363668


##########
src/libguac/mem.c:
##########
@@ -0,0 +1,252 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "guacamole/error.h"
+#include "guacamole/mem.h"
+#include "guacamole/private/mem.h"
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/*
+ * ============================================================================
+ *
+ * IMPORTANT: For compatibility with past usages of libguac, all allocation
+ * functions implemented here need to remain compatible with the standard
+ * free() function, as there are past usages of libguac functions that expect
+ * allocated memory to have been allocated with malloc() or similar. Some good
+ * examples of this would be guac_strdup() or guac_user_parse_args_string().
+ *
+ * It is OK if these allocation functions add new functionality beyond what
+ * malloc() provides, but care must be taken to ensure free() can still be used
+ * safely and without leaks, even if guac_mem_free() will always be preferred.
+ *
+ * It is further OK for guac_mem_free() to be incompatible with free() and only
+ * usable on memory blocks allocated through guac_mem_alloc() and similar.
+ *
+ * ============================================================================
+ */
+
+int PRIV_guac_mem_ckd_mul(size_t* result, size_t factor_count, const size_t* 
factors) {
+
+    /* Consider calculation invalid if no factors are provided at all */

Review Comment:
   Shouldn't this be returning a non-zero value if this is an invalid 
calculation?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to