Skip to content

Commit

Permalink
[CodeClean] check invalid param
Browse files Browse the repository at this point in the history
Code clean, check invalid param case in custom connection.

Signed-off-by: Jaeyun Jung <[email protected]>
  • Loading branch information
jaeyun-jung committed Dec 30, 2024
1 parent f5cd75f commit cc1fc7e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/libnnstreamer-edge/nnstreamer-edge-custom-impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "nnstreamer-edge-custom-impl.h"
#include "nnstreamer-edge-log.h"
#include "nnstreamer-edge-util.h"

typedef const nns_edge_custom_s *custom_get_instance (void);

Expand Down Expand Up @@ -69,6 +70,12 @@ nns_edge_custom_load (custom_connection_s * custom, const char *lib_path)
nns_edge_custom_s *custom_h;
int ret;

if (!STR_IS_VALID (lib_path))
return NNS_EDGE_ERROR_INVALID_PARAMETER;

if (!custom)
return NNS_EDGE_ERROR_INVALID_PARAMETER;

ret = _load_custom_library (custom, lib_path);
if (NNS_EDGE_ERROR_NONE != ret) {
nns_edge_loge
Expand Down Expand Up @@ -238,6 +245,10 @@ nns_edge_custom_send_data (custom_connection_s * custom, nns_edge_data_h data_h)
if (!custom || !custom->instance)
return NNS_EDGE_ERROR_INVALID_PARAMETER;

ret = nns_edge_data_is_valid (data_h);
if (NNS_EDGE_ERROR_NONE != ret)
return ret;

custom_h = custom->instance;

ret = custom_h->nns_edge_custom_send_data (custom->priv, data_h);
Expand All @@ -261,6 +272,9 @@ nns_edge_custom_set_info (custom_connection_s * custom, const char *key,
if (!custom || !custom->instance)
return NNS_EDGE_ERROR_INVALID_PARAMETER;

if (!STR_IS_VALID (key) || !STR_IS_VALID (value))
return NNS_EDGE_ERROR_INVALID_PARAMETER;

custom_h = custom->instance;

if (custom_h->nns_edge_custom_set_info) {
Expand All @@ -286,6 +300,9 @@ nns_edge_custom_get_info (custom_connection_s * custom, const char *key,
if (!custom || !custom->instance)
return NNS_EDGE_ERROR_INVALID_PARAMETER;

if (!STR_IS_VALID (key) || !value)
return NNS_EDGE_ERROR_INVALID_PARAMETER;

custom_h = custom->instance;

if (custom_h->nns_edge_custom_get_info) {
Expand Down

0 comments on commit cc1fc7e

Please sign in to comment.