Fix static analysis issues 04/295404/1
authorTomasz Swierczek <t.swierczek@samsung.com>
Thu, 6 Jul 2023 09:52:54 +0000 (11:52 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Thu, 6 Jul 2023 09:53:08 +0000 (11:53 +0200)
Change-Id: I7b2dc65e39e8da4c62c3396620dc502be839d611

src/notification-daemon/Logic.cpp
src/notification-daemon/ui/UIAppInvoker.cpp

index d0f10c5..8e6761f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2017-2020 Samsung Electronics Co., Ltd. All rights reserved
+ *  Copyright (c) 2017-2023 Samsung Electronics Co., Ltd. All rights reserved
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -345,7 +345,7 @@ void Logic::extResponse(Protocol::ConnectionFd fd, Protocol::RequestId id,
 
         std::map<Privacy, int> received;
         unsigned int i = 0;
-        for (auto p : privacies) {
+        for (auto &p : privacies) {
             received[p] = responses[i++];
 
             if (received[p] != ASKUSER_DENY_ONCE &&
index cb4c594..13e92f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2020 - 2023 Samsung Electronics Co., Ltd. All rights reserved
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
  *    you may not use this file except in compliance with the License.
@@ -127,7 +127,7 @@ bool UIAppInvoker::invoke(int popup_id, pid_t caller_app_pid, const std::string
 
     memset(privacies_c, 0, privacies.size());
 
-    for (auto p : privacies) {
+    for (auto &p : privacies) {
         if (!(privacies_c[i] = new char[p.size() + 1])){
             ALOGE("Cannot allocate memory for bundle creation");
             ret = -1;