@@ -164,7 +164,11 @@ static string_t run(struct CommandEntry *entry) {
164164 break ;
165165
166166 case TELLY_STR :
167- take_as_string (& value , entry -> args -> data [1 ]);
167+ if (take_as_string (& value , entry -> args -> data [1 ]) == -1 ) {
168+ PASS_NO_CLIENT (entry -> client );
169+ return RESP_ERROR_MESSAGE ("Out of memory" );
170+ }
171+
168172 break ;
169173
170174 default :
@@ -184,7 +188,11 @@ static string_t run(struct CommandEntry *entry) {
184188 break ;
185189
186190 case TELLY_STR :
187- take_as_string (& value , entry -> args -> data [1 ]);
191+ if (take_as_string (& value , entry -> args -> data [1 ]) == -1 ) {
192+ PASS_NO_CLIENT (entry -> client );
193+ return RESP_ERROR_MESSAGE ("Out of memory" );
194+ }
195+
188196 break ;
189197
190198 default :
@@ -198,12 +206,20 @@ static string_t run(struct CommandEntry *entry) {
198206 return RESP_ERROR_MESSAGE ("The type must be string for this value" );
199207 }
200208
201- take_as_string (& value , entry -> args -> data [1 ]);
209+ if (take_as_string (& value , entry -> args -> data [1 ]) == -1 ) {
210+ PASS_NO_CLIENT (entry -> client );
211+ return RESP_ERROR_MESSAGE ("Out of memory" );
212+ }
202213 }
203214
204215 if (get ) {
205216 if (entry -> password -> permissions & P_READ ) {
206- set_data (entry -> database , res , key , value , type );
217+ const bool success = (set_data (entry -> database , res , key , value , type ) != NULL );
218+
219+ if (!success ) {
220+ PASS_NO_CLIENT (entry -> client );
221+ return RESP_ERROR_MESSAGE ("Out of memory" );
222+ }
207223
208224 if (res ) {
209225 if (entry -> client ) {
@@ -224,7 +240,7 @@ static string_t run(struct CommandEntry *entry) {
224240 if (success ) {
225241 return RESP_OK ();
226242 } else {
227- return RESP_ERROR ( );
243+ return RESP_ERROR_MESSAGE ( "Out of memory" );
228244 }
229245 }
230246}
0 commit comments