Applying prevent result
authorSung-jae Park <nicesj.park@samsung.com>
Tue, 21 Aug 2012 00:31:44 +0000 (09:31 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Tue, 21 Aug 2012 01:30:54 +0000 (10:30 +0900)
CID 17690 src/io.c
CID 16726 src/script_handler.c
CID 16725 src/group.c
CID 13894 src/buffer_handler.c
CID 13891 pkgmgr_livebox/src/service_register.c
CID 13445 slave_rpc.c
CID 11755 parser.c
CID 11344 client_rpc.c

Change-Id: I6411ed372c469ac622759c0cb4910efbdf30f8c1

pkgmgr_livebox/src/service_register.c
src/buffer_handler.c
src/client_rpc.c
src/group.c
src/io.c
src/parser.c
src/script_handler.c
src/slave_rpc.c

index bb61271..41926eb 100644 (file)
@@ -1243,6 +1243,7 @@ static inline int livebox_destroy(struct livebox *livebox)
                free(group);
        }
 
+       free(livebox);
        return 0;
 }
 
index a6ac722..a8c912d 100644 (file)
@@ -225,6 +225,7 @@ int buffer_handler_unload(struct buffer_info *info)
                if (unlink(path) < 0)
                        ErrPrint("unlink: %s\n", strerror(errno));
 
+               free(path);
                free(info->id);
 
                info->id = strdup("file:///tmp/.live.undefined");
index 533de65..9b97cc1 100644 (file)
@@ -78,8 +78,10 @@ static int recv_cb(pid_t pid, int handle, const struct packet *packet, void *dat
        if (packet) {
                int ret;
 
-               packet_get(packet, "i", &ret);
-               DbgPrint("returns %d\n", ret);
+               if (packet_get(packet, "i", &ret) != 1)
+                       ErrPrint("Invalid packet received\n");
+               else
+                       DbgPrint("returns %d\n", ret);
        }
 
        destroy_command(command);
index cc81aa2..ffb2e5c 100644 (file)
@@ -261,7 +261,7 @@ int group_add_livebox(const char *group, const char *pkgname)
                        free(name);
 
                        if (!cluster) {
-                               ErrPrint("Failed to get cluster for %s\n", name);
+                               ErrPrint("Failed to get cluster\n");
                                return -EFAULT;
                        }
 
index 50722bf..3c03148 100644 (file)
--- a/src/io.c
+++ b/src/io.c
@@ -39,7 +39,7 @@ static struct {
 static inline int load_abi_table(void)
 {
        FILE *fp;
-       char ch;
+       int ch;
        int idx;
        int tag_id;
        enum {
index 7c58be6..b4dc0ab 100644 (file)
@@ -296,7 +296,6 @@ static inline int parse_size(const char *buffer, unsigned int *size)
                        w = 0;
                        h = 0;
                        break;
-               case ERROR:
                default:
                        return -1;
                }
index c32d40a..fa81a0d 100644 (file)
@@ -1002,6 +1002,7 @@ int script_handler_parse_desc(const char *pkgname, const char *id, const char *d
                        free(block->group);
                        free(block->id);
                        free(block);
+                       block = NULL;
 
                        state = UNKNOWN;
                        break;
index edf6cd4..19681f2 100644 (file)
@@ -319,11 +319,6 @@ static Eina_Bool ping_timeout_cb(void *data)
        return ECORE_CALLBACK_CANCEL;
 }
 
-static inline int slave_rpc_is_valid(struct slave_rpc *rpc)
-{
-       return rpc && rpc->handle > 0;
-}
-
 int slave_rpc_async_request(struct slave_node *slave, const char *pkgname, struct packet *packet, void (*ret_cb)(struct slave_node *slave, const struct packet *packet, void *data), void *data)
 {
        struct command *command;
@@ -344,7 +339,17 @@ int slave_rpc_async_request(struct slave_node *slave, const char *pkgname, struc
        command->cbdata = data;
 
        rpc = slave_data(slave, "rpc");
-       if (!slave_rpc_is_valid(rpc)) {
+       if (!rpc) {
+               ErrPrint("Slave has no RPC yet\n");
+               if (ret_cb)
+                       ret_cb(slave, NULL, data);
+
+               destroy_command(command);
+               packet_unref(packet);
+               return -EFAULT;
+       }
+
+       if (rpc->handle < 0) {
                DbgPrint("RPC info is not ready to use, push this to pending list\n");
                rpc->pending_list = eina_list_append(rpc->pending_list, command);
                packet_unref(packet);